HTML reference

hidden

The hidden attribute says that an element is not currently relevant and should not be presented to the user. Remove it when the content becomes relevant.

What you will learn

  • What state hidden represents
  • How it differs from hiding a submitted form value
  • How to reveal content as part of an accessible interaction

Basic example

<section id="details" hidden>
  Extra details
</section>

<button type="button" aria-controls="details" aria-expanded="false">
  Show details
</button>

JavaScript can remove the hidden attribute and update aria-expanded when the button opens the section. The control and the content should have a clear relationship.

Important distinctions

Related pages