在Internet Explorer中以粗体显示样式选项 [英] Styling options in bold in Internet Explorer

查看:162
本文介绍了在Internet Explorer中以粗体显示样式选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在选项中遇到样式问题。我需要一些选项以粗体样式显示,但Internet Explorer不想渲染它。

I am getting a styling problem with options. I need some options to appear in bold style, but Internet Explorer doesn't want to render it.

我使用CSS设置:

font-weight: bold;

这不工作。
在此页面中可以看到一个示例:

Which is not working. An example can be seen in this page:

示例

在Firefox中显示粗体字体,但在Internet Explorer中不显示。

which shows bold fonts in Firefox but not in Internet Explorer.

我在Internet Explorer 7和8上尝试过。

I have tried in Internet Explorer 7 and 8.

有人有替代品吗?

编辑:
示例:

A sample:

HTML:

<select>
    <option class="special">Special</option>
</select>

CSS:

.special {
    font-weight: bold;
}


推荐答案

< option> 元素。这是因为IE使用Windows窗体控件来渲染选择框,它不支持此功能。

IE doesn't allow styling of <option> elements independently. This is because IE uses a Windows form control to render the select box, which doesn't support this feature.

(另一方面,这与IE的选择框在将其放在其他对象后面时可能会出现分层问题;表单控件由Windows操作系统呈现,而不是由浏览器呈现,因此浏览器对该页面上的大多数其他元素的控制较少)

(as an aside, this is the same reason that IE's select boxes can have issues with layering when you put them behind other objects; the form control is being rendered by the Windows OS, not by the browser, so the browser has less control over it than most other elements on the page)

其他现代浏览器允许你这样做,因为他们渲染自己的选择框而不是推迟到操作系统。

Other modern browsers do allow you to do it, as they render their own select boxes rather than deferring to the OS.

这篇关于在Internet Explorer中以粗体显示样式选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆