caret-color

Avatar of Chris Coyier
Chris Coyier on (Updated on )

DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit!

The caret-color property in CSS changes the color of the cursor (caret) in inputs, texareas, or really any element that is editable, like:

input,
textarea,
[contenteditable] {
  caret-color: red;
}

The color of the caret generally matches the color of the text, but this property allows you to change those independently.

Faking it

Before this existed there was a method for faking it involving forcing the text to be transparent (where supported via -webkit-text-fill-color) and making the text show back up, colorized, via text-shadow.

Browser Support

This browser support data is from Caniuse, which has more detail. A number indicates that browser supports the feature at that version and up.

Desktop

ChromeFirefoxIEEdgeSafari
5753No7911.1

Mobile / Tablet

Android ChromeAndroid FirefoxAndroidiOS Safari
12612712611.3-11.4