In this section, we will learn what the hidden attribute is and how to use it in HTML.
HTML hide element with hidden attribute
The hidden attribute, as the name suggests, is used to hide an element in an HTML document.
Basically, browsers won’t render an element that has this attribute in its opening tag.
We use this attribute when want to keep users from seeing an element until they do some actions in an HTML document.
HTML hidden Attribute Syntax
HTML hidden Attribute Values
The hidden attribute is a boolean attribute. That means we only need to put this element in the opening tag of an element. After that, the element becomes hidden in the document.
Example: hide a div in HTML
See the Pen hide a div in HTML by Omid Dehghan (@odchan1) on CodePen.
Example: HTML button hidden
See the Pen HTML button hidden by Omid Dehghan (@odchan1) on CodePen.