DEV Community

Cover image for HTML hidden element
Digital Academy
Digital Academy

Posted on • Originally published at gitdemy.com

HTML hidden element

What is The HTML hidden attribute?

The HTML hidden attribute is used to hide an element. It indicates that the element is not yet, or no longer, relevant. It sets the visibility of the elements in the document. When it is present the browser will not display the element to the user, but it remains in its position on the webpage.

The hidden element is used to not show the element to the user unless certain conditions are met such as pressing a button or checkbox, etc. Using JavaScript statement, the hidden attribute can be removed and make the element visible to the user.

Note: The hidden attribute is a boolean attribute.
Example 1
<!DOCTYPE html>
<html>
<head>
<title>hidden attribute</title>
</head>
<body>
<h1>GitDemy</h1>
<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 development.</h4>
</body>
</html>

Output
In the following example, the div element is hidden from the user's view.

Image HTML hidden attribute example output

This article is originally posted on GitDemy
Read full article, click the below link.
HTML hidden attribute

Top comments (0)