How to change cursor color without changing text color?

前端 未结 5 2087
日久生厌
日久生厌 2020-12-02 00:12

I want to have the cursor #FFF while my font is #000.

Is that possible?

5条回答
  •  盖世英雄少女心
    2020-12-02 00:56

    to change caret color CSS of input type text and textarea use below css

    input,textarea {
         color: #8f0407;
         text-shadow: 0px 0px 0px #000 ;
         -webkit-text-fill-color: transparent ;
    }
    
    input::-webkit-input-placeholder,
         textarea::-webkit-input-placeholder {
         color: #ccc;
         text-shadow: none;
         -webkit-text-fill-color: initial;
    }
    

    Codepen Demo

提交回复
热议问题