5

Can I change the caret color inside a content editable div.
Cursor color is always same as text color, red in my case. So my question is that is there a way to change the caret color to black? eg caret-color:black HTML:

<div class="red" contenteditable="true"> hello </div>

css:

.red{
   color:red;
  }

Check this link

Vishu238
  • 673
  • 4
  • 17

3 Answers3

4

Yes. Use modern CSS!

div {
    caret-color : black;
}
Gibolt
  • 42,564
  • 15
  • 187
  • 127
0

ok.here's the solution :) http://codepen.io/anon/pen/avbVzx **

<input id="a" type="text">
<input id="b" type="text">
#a{
color:black;
-webkit-text-fill-color: red;
}
#b{
color:red;
-webkit-text-fill-color: green;
}
}

**

kobi
  • 81
  • 4
-1

hi i think this may help you for your answer

.red{  
    color:red;
}
.red:focus{  
    outline:red;
    border:2px solid red;
}
<div class="red" contenteditable="true"> hello </div>

here is the demo fiddle working code

Demo code

Himesh Aadeshara
  • 2,114
  • 16
  • 26