Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

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

  • Last Updated : 01 Aug, 2021

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
Recommended Articles
Page :