Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

HTML term or value: hidden

The `hidden` attribute marks content as not currently intended for presentation; a special state lets the browser reveal a matching fragment during find-in-page.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

<section hidden>…</section>

hidden is an enumerated attribute. The hidden state covers the empty value, the hidden keyword, and invalid values, while until-found selects the hidden-until-found state; absence means ordinary presentation.

Writing hidden="false" does not disable hiding because false is not such a token and falls into the hidden state. Remove the attribute to show the element; do not defeat its semantics with an author style that forces rendering.

In the findable state the browser can locate text, fire beforematch, remove hidden, and scroll to the content. Ordinary hidden content is not rendered or exposed as accessible content, but it remains in the DOM, so this is not protection for secrets.

The example reads the hidden property as true, computed display as none, while document.body.contains() still confirms tree membership. Suppressing presentation does not remove the node.

Examples

<!doctype html><meta charset="utf-8"><section id="x" hidden>Secret</section><output id="result"></output><script>result.textContent=`hidden=${x.hidden}; display=${getComputedStyle(x).display}; inDom=${document.body.contains(x)}`;</script>

Result

hidden=true; display=none; inDom=true

The executed example verifies both non-rendering and continued DOM presence of a hidden element.

Sources