首页 > 解决方案 > 如何在 Bootswatch 中的多选选项中左右对齐文本

问题描述

我正在使用 Bootswatch 砂岩https://bootswatch.com/sandstone/

我有一个带有源代码的表格:

<div class="form-group">
  <label for="exampleSelect2">Example multiple select</label>
  <select multiple="" class="form-control" id="exampleSelect2">
    <option><p class="text-left">Subject 1<p><p class="text-right">500 views</p></option>
    <option><p class="text-left">Subject 2<p><p class="text-right">400 views</p></option>
  </select>
</div>

如何在选项中左右对齐文本值?

标签: formstextbootstrap-4alignmentbootswatch

解决方案


据我所知,选项标签中不可能有不同的格式。您可以使用的一个选项是使用 title 属性将信息显示为工具提示,如下所示:

<div class="form-group">
  <label for="exampleSelect2">Example multiple select</label>
  <select multiple="" class ="form-control" id="exampleSelect2">
    <option title="500 views">Subject 1</option>
    <option title="400 views">Subject 2</option>
  </select>
</div>

推荐阅读