I have a small CSS issue with Safari on iPhone device. My search input is blue and when user focuses on it, caret is almost invisible:
In all desktop browsers, it has right color (white), even on desktop Safari. Any idea how to fix this and change caret color on iOS device?
Input styles:
input {
background-color: $stateBlue;
height: $navbarItemHeight;
padding: 0 10px;
vertical-align: bottom;
color: $white;
border-radius: $borderRadius;
font-size: 1.1666666667em; // 16px
-moz-appearance:none;
-webkit-appearance:none;
&::-webkit-input-placeholder {
text-shadow: none;
-webkit-text-fill-color: initial;
}
}
There is a W3C specification for this called caret-color
which can be used like this:
input[type="text"].custom {
caret-color: red;
}
<div>
<label>default caret:</label>
<input type="text"/>
</div>
<div>
<label>custom red caret:</label>
<input type="text" class="custom"/>
</div>
It's currently supported by Chrome (also on Android), Firefox, Opera and Safari (including iOS).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With