如何在IE中的HTML选择下拉列表中设置font-family?

时间:2012-09-21 06:34:53

标签: html css internet-explorer drop-down-menu html-select

  

可能重复:
  Change css font-family for separate options in select tag
  Styling options in bold in Internet Explorer

我无法在IE8,9中设置HTML select下拉列表的font-family。 是错误/属性还是我做错了什么?字体大小设置有效。这个例子太极端我真正的问题是我在页面和列表中有不同的字体。
我不关心IE7-。

示例(http://jsfiddle.net/SDcLX/11/):

我有以下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>

和CSS

.container
  {
    font-size:30px;
    font-family:Lucida Handwriting;
   }
select
{
    font-family:inherit;
    font-size:inherit;
}

option.courier
 {
    font-family:courier;
 }

FF中的结果是:

enter image description here

并在IE中:

enter image description here

1 个答案:

答案 0 :(得分:0)

问题也是styling options in bold in internet explorer

的重复

显然IE使用操作系统来渲染控件。

也许您可以使用js小部件而不是this one 它需要一个基本的选择,但用jquery转换它。