【问题标题】:Ho do I group HTML select option text into columns如何将 HTML 选择选项文本分组到列中
【发布时间】:2016-05-17 05:12:55
【问题描述】:

我有一个带有文本的 HTML 选择选项,我想将其分组到对齐的列中。我尝试使用内联块:

<select>
  <option><span div="display:inline-block;width:3em;">A:</span><span style="display:inline-block;width:5em;">Lorem Ipsum</span>
  </option>
  <option><span div="display:inline-block;width:3em;">AA:</span><span style="display:inline-block;width:5em;">Fusce efficitur ante</span>
  </option>
</select>

我想得到输出:

A   Lorem Ipum
AA  Fusce efficitur ante

是否有任何 Twitter 引导程序?

【问题讨论】:

    标签: html css twitter-bootstrap


    【解决方案1】:

    不幸的是,我们 can't set the style 用于 option 元素,background-colorcolor 除外。

    但我们可以尝试使用&amp;nbsp; 和像courier 这样的等宽字体。

    select, option {
      font-family: courier;
    }
    <select>
      <option>A:&nbsp;&nbsp;Lorem Ipsum</option>
      <option>AA:&nbsp;Fusce efficitur ante</option>
    </select>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-29
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      • 2023-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多