Skip to content
Related Articles
Open in App
Not now

Related Articles

How to hide the insertion caret in a webpage using CSS ?

Improve Article
Save Article
Like Article
  • Last Updated : 01 Aug, 2021
Improve Article
Save Article
Like Article

Insertion caret or text input cursor generally refers to a flashing, thin vertical line. It functions in an input field to indicate where the next character typed will be inserted.

If you wish to hide this input cursor from input fields in your webpage, the caret-color property of CSS is used. It has three property values including auto, color, and transparent. In this article, we’ll focus on the transparent value. 

Syntax:

caret-color: transparent;

Example: The following example hides the text input cursor using CSS.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Hide insertion caret</title>
    <style>
        body {
            text-align: center;
        }
  
        .hidden {
            caret-color: transparent;
        }
    </style>
</head>
  
<body>
    <h2 style="color:green;">Welcome To GFG</h2>
    <h2> Visible Input Text Cursor </h2>
    <input type="text"><br><br>
    <h2> Hidden Input Text Cursor Using
        <b>transparent</b> value
    </h2>
    <input type="text" class="hidden">
</body>
  
</html>

Output:

Hide cursor

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!