加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 将光标更改为标签?

发布时间:2020-12-14 23:46:02 所属栏目:资源 来源:网络整理
导读:当鼠标悬停在 select中的项目上时,有没有办法更改光标?组合框?我假设做了选项{cursor:pointer;在CSS中可以工作,但似乎没有. 解决方法 可悲的是, option标记由操作系统而不是浏览器呈现,因此您无法使用游标设置它们的样式.相反,使用像 Bootstrap’s Dropdo
当鼠标悬停在< select>中的项目上时,有没有办法更改光标?组合框?我假设做了选项{cursor:pointer;在CSS中可以工作,但似乎没有.

解决方法

可悲的是,< option>标记由操作系统而不是浏览器呈现,因此您无法使用游标设置它们的样式.相反,使用像 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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读