Hidden Attribute in HTML5

In this article I am going to describe about the use of Hidden attribute in HTML5.
  • 2205

Hidden Attribute

The Hidden attribute is used to hide any content. Hidden attribute is new in HTML5.

When present, it specifies that an element is not yet, or is no longer, relevant. The browser/user agent does not display elements that have the hidden attribute present.

The hidden attribute can also be used to keep a user from seeing an element until some condition is true. Then, a JavaScript could remove the hidden attribute, and make the element visible.

Hidden attribute is an Boolean attribute.

Possible Ways are

  1. <ElementName hidden>
  2. <ElementName hidden="hidden">
  3. <ElementName hidden="true">

Syntax

<elementname hidden="hidden">

Browser Support

It is supported in all major browsers except Internet Explorer.

Example of Hidden Attribute

<!DOCTYPE html>

 

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>

    <meta charset="utf-8" />

    <title>Hidden Attribute</title>

</head>

<body>

    <h2>Hidden Attribute in HTML5</h2>

    <p hidden>This paragraph should be hidden.Nobody can see me.</p>

    <p>This is a visible paragraph.</p>

    <p><b>Note:</b> The hidden attribute is not supported in IE.</p>

</body>

</html>

 

Output

hidden.jpg

© 2019 DotNetHeaven. All rights reserved.