Open In App

What is the Purpose of the Hidden Attribute in HTML?

The hidden attribute in HTML is used to indicate that an element is not yet, or is no longer, relevant or needed for the user interface. It effectively hides the element from view but does not remove it from the document structure.

Note: The hidden attribute is a boolean attribute, meaning its presence alone is sufficient, and it doesn’t require a value.

Syntax:

<!-- Hiding an element using the hidden attribute -->
<div hidden>
This content is hidden.
</div>

<!-- Hiding a form input using the hidden attribute -->
<input type="text" hidden>

Features:

The hidden Attribute also:

Article Tags :