Open In App

HTML hidden Attribute

Last Updated : 28 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
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:


Next Article

Similar Reads