当前第2页 返回上一页
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <!DOCTYPE html>
< html >
< head >
< style type = "text/css" >
input {
color: red;/* 文本颜色和光标颜色设置为 red */
}
input::first-line {
color: #333;/* 设置文本颜色,将文本颜色和光标颜色区分开来 */
}
</ style >
</ head >
< body >
< input class = "example" value = "自定义光标颜色" >< br >< br >
</ body >
</ html >
|
效果图:

借助::first-line伪元素的方法在Chrome,Safari浏览器下表现良好,但是Firefox浏览器并不支持
兼容方式:
1 2 3 4 5 6 7 8 | input {
color: #333;
caret-color: red;
}
@supports (-webkit-mask: none) and (not (cater-color: red)) {
input { color: red; }
input::first-line { color: #333; }
}
|
(学习视频分享:css视频教程)
以上就是css如何修改光标颜色的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
什么是web安全色?
css精灵技术有什么用?
css中词语间隔怎么设置
css怎么连接到html
css改变滚动条样式
教你一招搞定css背景图的大小
css中的classlist的意思是什么
css中怎么设置背景图
css text-overflow属性怎么用
html中表单的相关知识总结(代码实例)
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css如何修改光标颜色