样式选项组标签 [英] Styling option group label
本文介绍了样式选项组标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以只在下拉选择器中设置optgroup的标签?
Is it possible to style just the label of the optgroup in drop-down selector?
<select>
<optgroup label="Group Name">
<option>My option</option>
</optgroup>
</select>
推荐答案
使用属性选择器
[label]
{
color: red;
}
EDIT
<select>
<optgroup label="Cars">
<option>Honda</option>
<option>Merc</option>
</optgroup>
<optgroup label="Bikes">
<option>Kawasaki</option>
<option>Yamaha</option>
</optgroup>
</select>
optgroup[label="Cars"]
{
color: red;
}
optgroup[label="Bikes"]
{
color: blue;
}
option
{
color: black;
}
这篇关于样式选项组标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文