问题描述
有任何方法可以在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如何做:
And here's a great "howto" on how to do it: http://www.devirtuoso.com/2009/08/styling-drop-down-boxes-with-jquery/
这篇关于在chrome中选择下拉选项粗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!