如何在 IE 中的 HTML 选择下拉列表中设置字体系列?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12525375/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set font-family in HTML select dropdown list in IE?
提问by IvanH
Possible Duplicate:
Change css font-family for separate options in select tag
Styling options in bold in Internet Explorer
I am not able to set font-family of a dropdown list of HTML select in IE8,9. Is it a bug/property or am I doing something wrong?Font-size setting works. The example is too extreme my real problem is that I have different font on the page and in the list.
I don't care about IE7-.
我无法在 IE8,9 中设置 HTML 选择下拉列表的字体系列。这是错误/属性还是我做错了什么?字体大小设置有效。这个例子太极端了,我真正的问题是页面和列表中的字体不同。
我不在乎 IE7-。
Example( http://jsfiddle.net/SDcLX/11/):
示例(http://jsfiddle.net/SDcLX/11/):
I have following HTML:
我有以下 HTML:
aaaaa
<div class="container">
skjhlks <select>
<option class="courier">courier</option>
<option>aa</option>
<option style="font-family:impact;" selected="selected" >bb</option>
</select>
</div>
and CSS
和 CSS
.container
{
font-size:30px;
font-family:Lucida Handwriting;
}
select
{
font-family:inherit;
font-size:inherit;
}
option.courier
{
font-family:courier;
}
The result in FF is:
FF 中的结果是:
and in IE:
在 IE 中:
回答by FHoffmeyer
The question is also a duplicate of styling options in bold in internet explorer
该问题也是Internet Explorer 中粗体样式选项的重复
Apparently IE uses the operationg system to render the controls.
显然 IE 使用操作系统来呈现控件。
Perhaps you can use a js widget instead like this oneIt takes a basic select but transorms it with jquery.
也许你可以使用窗口小部件一个js,而不是像这样一个它需要一个基本的选择,但与jQuery transorms它。