html - 将光标更改为 <option> 标签?

标签 html css drop-down-menu

将鼠标悬停在 <select> 中的元素上时,有什么方法可以更改光标吗?组合框?我假设做 option { cursor: pointer; }在 CSS 中会起作用,但它似乎不起作用。

最佳答案

制作您自己的下拉菜单

<option>标签由操作系统而非浏览器呈现,因此您无法设置它们的样式。

相反,制作您自己的可以完全控制的下拉菜单或使用第 3 方插件,例如 Bootstrap's Dropdown .

MSDN says it best :

Except for background-color and color, style settings applied through the style object for the option element are ignored. In addition, style settings applied directly to individual options override those applied to the containing select element as a whole.

MDN also chimes in

Some elements simply can't be styled using CSS. These include all advanced user interface widgets such as range, color, or date controls as well as all the dropdown widgets, including <select>, <option>, <optgroup> and <datalist> elements. The file picker widget is also known not to be stylable at all. The new <progress> and <meter> elements also fall in this category.

关于html - 将光标更改为 <option> 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22770603/

相关文章:

html - 如何使下拉菜单 View 为垂直?

html - 为什么字体属性不适用于类内的文本?

html - 高分辨率图像 IE 浏览器渲染

javascript - 当显示元素而不是实际值时,元素偏移返回 0

c# - 在 C# 中发送电子邮件时不显示背景颜色

javascript - 从上一个标签获取下一个标签

html - CSS3 Filter 可以应用于 <select> 内的选项吗?

php - MySql php 的重复结果

javascript - CSS max-height 不起作用,但同一 div 的高度起作用

jquery - wordpress Bootstrap 菜单在悬停时加载,希望它仅在单击时加载和卸载