CSS | caret-color Property

This property is used to set the color of cursor in inputs, text area or other editable area.

Syntax:

caret-color: auto|color;

Below examples illustrate the caret-color property in CSS:
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>caret-color property</title>
        <style>
            body {
                text-align: center;
            }
            .geeks {
                caret-color: red;
            }
            .gfg {
                caret-color: transparent;
            }
        </style>
    </head>
    <body>
        <h1 style="color:green;">GeeksForGeeks</h1>
        <h1>The caret-color Property</h1>
        <input value="geeksforgeeks"><br><br>
        <input class="geeks" value="C programming"><br><br>
        <input class="gfg" value="Java programming">
        <p contenteditable class="geeks">A computer science poertal for geeks</p>
    </body>
</html>

chevron_right


Output:

Property:

  • auto: It has a default value. It uses the current-color in the web browser.
  • color: It is used to specify the color value use for the caret. All values can be used (rgb, hex, named-color, etc).

Supported Browsers: The browser supported by caret-color property are listed below:

  • Google chrome 57.0 and above
  • Internet Explorer: Not supported
  • Mozilla 53.0 and above
  • Safari 11.1 and above
  • Opera 44.0 and above


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.