如何在所有浏览器中加粗选择的第一个选项? [英] How to bold the first option of a select across all browsers?

查看:72
本文介绍了如何在所有浏览器中加粗选择的第一个选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图加粗选择框的第一个选项,但它只工作在Firefox,而不是其他浏览器(Chrome,IE)。这是我试过的代码。

I have tried to bold the first option of the select box but it's only working in Firefox, not other browsers (Chrome, IE). Here is the code I've tried.

HTML

<select id="htmldisabled">
    <option class="bold">test1</option>
    <option>test2</option>
    <option>test3</option>
    <option>test4</option>
    <option>test5</option>
    <option>test6</option>
</select>

CSS

.bold {
     font-weight:bold;   
}

请参阅

See demo at jsfiddle.

推荐答案

正如你所发现的,它不能通过跨浏览器来完成;)

As you've discovered, it can't be done cross-browser ;)

最好使用选择框替换脚本,如果您需要特殊格式或显示

Best to use a selectbox replacement script if you need special formatting or display

这篇关于如何在所有浏览器中加粗选择的第一个选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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