The caret-color property

The caret-color property sets a color of the text cursor in the input that appears when entering text. The property can take two values: auto (default) and the user-selected color.

Syntax

cssselector {
  caret-color: auto or color;
}

Example

Let's set the default text cursor color:

html<input>
cssinput {
  padding: 5px;
  caret-color: auto;
}

Результат:

Example

Now let's recolor the text cursor blue:

html<input>
cssinput {
  padding: 5px;
  caret-color: blue;
}

Результат:

See also

  • the :fullscreen pseudo-class
    that styles elements in full screen mode
  • the :indeterminate pseudo-class
    that styles switches that are in an indeterminate state
  • the :focus-within pseudo-class
    that styles the elements in focus