如何更改选择框的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:

>