如何更改选择框的optgroup标签的样式 [英] How to change the style of a Select box' optgroup label

查看:1168
本文介绍了如何更改选择框的optgroup标签的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中有一个带有选项组的简单选择框。

I have a simple select box with an optiongroup in my application.

<select>
   <optgroup label="Swedish Cars">
     <option value="volvo">Volvo</option>
     <option value="saab">Saab</option>
 </optgroup>
  ----
  ----
  ----
</select>

当它显示在浏览器中时,选项组标签以粗体和斜体显示;

When it gets displayed in browser, the option group label is displayed with bold and italic; I want it to be displayed without any of those styles.

推荐答案

不幸的是,选择框是您可以添加的几个内容之一非常小的风格与CSS。

Unfortunately select boxes are one of the few things that you can add very little style to with CSS. You are usually limited to how the browser renders it.

例如,在chrome中看起来像这样:

For example, it looks like this in chrome:

>

这篇关于如何更改选择框的optgroup标签的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆