Select2 - 如何插入粗体标题? [英] Select2 - How to insert a bolded headline?
本文介绍了Select2 - 如何插入粗体标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我查看了所有select2的文档,但无法找到如何插入这些粗体标题:
I've looked in all the select2's documentation and could not find how can I insert those bold headlines:
有人能提供完整的代码示例(需要CSS吗?)如何实现这个?
Can someone provide a complete code example (CSS needed ?) of how to achieve this?
推荐答案
您可以使用 optgroup
标记来实现此目的。
You can achieve this by using the optgroup
tag.
<select style="width:300px">
<optgroup label="Alaskan/Hawaiian Time Zone">
<option value="AK">Alaska</option>
<option value="HI">Hawaii</option>
</optgroup>
<optgroup label="Pacific Time Zone">
<option value="CA">California</option>
<option value="NV">Nevada</option>
<option value="OR">Oregon</option>
<option value="WA">Washington</option>
</optgroup>
</select>
您需要确保包含Select2 CSS文件。如果看不到正确的字体,请尝试将正文设置为 Arial
。
You'll need to make sure that you include the Select2 CSS file. If you do not see the correct font, try setting the body to Arial
.
http://jsfiddle.net/munr/gept53a2/
这篇关于Select2 - 如何插入粗体标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文