html - 如何在所有浏览器中加粗选择的第一个选项?

标签 html css html-select

我试图将选择框的第一个选项加粗,但它只适用于 Firefox,不适用于其他浏览器(Chrome、IE)。这是我试过的代码。

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;   
}

参见 jsfiddle 的演示.

最佳答案

#htmldisabled:first-child{
    font-weight:bold;
}

关于html - 如何在所有浏览器中加粗选择的第一个选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8356797/

相关文章:

javascript - 当 phonegap 版本从 1.5 更新到 1.9 时,android 中的 Phonegap 应用程序导致强制关闭

css - 使用 css 显示其他元素时捕获元素

javascript - 选择随机选项并执行功能

html - 无法在下拉列表中选择项目

javascript - 溢出的div中的绝对div

html - 透明背景和标志

javascript - 在 Electron 应用程序中将本地文件加载到 iframe 中

javascript - 使用 jQuery 专注于第一个可见和空的选择/下拉

html - 如何使 'four corner'与 float div对齐

javascript - 如何在 kinetic.js 中选择一个对象?