选择下拉式选项,在chrome中加粗 [英] Select dropdown option bold in 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屋!