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

查看:193
本文介绍了在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>

这个问题与这里,但没有回答。

This is the same question as here, but there was no answer.

推荐答案

。最有可能的解决方案,你会发现在那里将添加一个硬编码风格的周围跨度,但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天全站免登陆