选择下拉式选项,在chrome中加粗 [英] Select dropdown option bold in chrome

查看:130
本文介绍了选择下拉式选项,在chrome中加粗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Chrome和IE中的选择框中创建< option> 标签粗体使用CSS?它在Firefox中工作。

Is there any way to make an <option> tag bold in a select box in Chrome and IE using CSS? It's working in Firefox.

option.red {
    background-color: #cc0000; 
    font-weight: bold; 
    font-size: 12px; 
    color: white;
}



<select name="color">
    <option class="red" value="red">Red</option>
    <option value="white">White</option>
    <option value="blue">Blue</option>
    <option value="green">Green</option>
</select>

这与这里,但没有答案。

推荐答案

你不能这样做。你会发现在那里的最有可能的解决方案是添加一个硬编码风格的周边跨度,但IE(7)和Firefox(3.0.12)都不会这样。

You cannot do this. The most likely solution you'll find "out there" would be to add a surrounding span with hard coded style, but neither IE (7) nor Firefox (3.0.12) honor this.

您可以做的是使用JavaScript解决方案给您一个选择的外观,而不实际使用选择。

What you can do is use a JavaScript solution to give you the appearance of a select without actually using a select.

这是一个很好的howto如何做: http://www.devirtuoso.com/2009/08/styling-drop-down-boxes-with-jquery/

And here's a great "howto" on how to do it: http://www.devirtuoso.com/2009/08/styling-drop-down-boxes-with-jquery/

这篇关于选择下拉式选项,在chrome中加粗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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