css如何修改光标颜色


当前第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>

效果图:

2.gif

借助::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如何修改光标颜色的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

css实现背景图满屏效果

css绝对定位详解

css怎么让两个背景重合

网页代码中js和css指的是什么

css链接状态有哪些

css中px是什么意思

css改变字体的属性有哪些

css中元素的浮动用什么属性

css三种样式表写法是什么

css怎么写五角星

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...