将鼠标悬停在 <select>
中的元素上时,有什么方法可以更改光标吗?组合框?我假设做 option { cursor: pointer; }
在 CSS 中会起作用,但它似乎不起作用。
最佳答案
制作您自己的下拉菜单
<option>
标签由操作系统而非浏览器呈现,因此您无法设置它们的样式。
相反,制作您自己的可以完全控制的下拉菜单或使用第 3 方插件,例如 Bootstrap's Dropdown .
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.
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/