将光标移到< option>标签?
当悬停在< select>
组合框中的项目时,是否有任何方法更改光标?我假设做选项{cursor:pointer; }
Is there any way to change the cursor when hovering over an item in a <select>
combobox? I assumed that doing option { cursor: pointer; }
in CSS would work, but it doesn't seem to.
很遗憾,< option>
标签是由操作系统而不是浏览器呈现的,因此您无法使用游标对它们进行样式化。而应使用类似 Bootstrap的下拉菜单的插件。
Sadly, <option>
tags are rendered by the operating system, not the browser, so you can't style them with cursors. Instead, use a plugin like Bootstrap's Dropdown.
除了背景颜色和颜色外,通过style元素的样式对象应用的样式设置将被忽略。此外,直接应用于单个选项的样式设置会覆盖整个应用于包含select元素的样式设置。
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也会在中发音
一些元素根本不能使用CSS样式。这些包括所有高级用户界面小部件,如范围,颜色或日期控件以及所有下拉窗口小部件,包括
< select>
,; option>
,< optgroup>
和< datalist>
文件选择器小部件也已知不是可定制的。< progress>
和< meter>
元素也属于此类别。
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.