How to change the default caret color on iOS for input?

Is there a way to change the blue caret color on iOS for inputs?

enter image description here

The UPDATE: . So the cant-color property will fix this issue when supported in ios. check browser support when you are here in the future https://caniuse.com/#feat=css-caret-color

+3


source to share


1 answer


I'm not sure what compatibility is -webkit-text-fill-color

, but if it's acceptable for compatibility, you can use a combination of this, text-shadow, color and background-color with css to create the input you want. No JS needed.

The framework for this approach has been described here: fooobar.com/questions/61492 / ...

Blue can be difficult to see (if you change it to white it will be a little more obvious).



input{
  color: #456ce1;
  text-shadow: 0px 0px 0px red;
  -webkit-text-fill-color: transparent;
  background-color: #272b36;
}
      

<input value = "CHCJ"/>
      

Run codeHide result


Don't forget to focus the input field with your mouse.

0


source







All Articles