Open In App

HTML hidden Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

The HTML hidden Attribute, a boolean attribute, hides elements from display in browsers. It’s useful for elements not yet relevant or hidden until certain conditions are met via JavaScript.

Syntax

<element hidden>

Note: This attribute is new in HTML 5.

Supported Tags

This is a Global attribute and can be used on any HTML element.

HTML hidden Attribute Example

Example 1: This simple example illustrates hiding the content from the user by using the hidden attribute with the <div> element in HTML.

HTML




<!DOCTYPE html>
<html>
    <head>
        <title>hidden attribute</title>
    </head>
 
    <body>
        <h2>HTML hidden attribute</h2>
 
        <!-- hidden paragraph -->
        <div hidden>
            This content will be hidden while
            displaying the content
        </div>
        <h4>
            A computer science portal for geeks
        </h4>
    </body>
</html>


Output:

hiddenAttribute

HTML hidden Attribute example output

Supported Browsers:


Last Updated : 07 Mar, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads