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:

HTML hidden Attribute example output

Supported Browsers:


HTML hidden Attribute

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.

Similar Reads

Syntax

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