【问题标题】:How to set font-family in HTML select dropdown list in IE? [duplicate]如何在 IE 中的 HTML 选择下拉列表中设置字体系列? [复制]
【发布时间】:2012-09-13 13:43:40
【问题描述】:

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

我无法在 IE8,9 中设置 HTML 选择下拉列表的字体系列。 这是错误/属性还是我做错了什么?字体大小设置有效。这个例子太极端了,我真正的问题是我在页面和列表中有不同的字体。
我不关心 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中的结果是:

在 IE 中:

【问题讨论】:

  • 至少类似,但没有说明是IE的问题。我的目标是使用与页面其他部分相同的字体,或者声明这是不可能的。

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


【解决方案1】:

这个问题也是styling options in bold in internet explorer的重复问题

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

也许您可以使用 js 小部件,例如 this one 它需要一个基本的选择,但使用 jquery 对其进行转换。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-24
    • 2015-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-20
    • 1970-01-01
    • 2011-05-20
    相关资源
    最近更新 更多