如何更改< select>的< optgroup>的样式标签? [英] How to change the style of a <select>'s <optgroup> label?

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

问题描述

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

I have a simple select box with an option group 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 in 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:

在Firefox中是这样的

And this in Firefox:

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

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