The hidden attribute

hidden completely hides an element — equivalent to display:none, but set directly in HTML with no CSS.

Applies to

global

Values

A boolean attribute: its mere presence hides the element (no value needed).

Example

<p hidden>This text isn't shown.</p>

Edge cases

  • hidden hides an element from screen readers too, and visually — this is NOT the same as a visually-hidden CSS class, which only hides it visually.
  • A CSS rule like display:block can override hidden, since hidden is implemented as display:none in the browser's default stylesheet, which has lower priority than explicit CSS rules.

Accessibility

  • To hide something "visually only, not from screen readers", use the visually-hidden CSS technique instead of hidden.

Related tools