Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Yes—when the element should be unavailable to everyone. display: none removes the element and its descendants from visual layout and, ordinarily, from the accessibility tree. Choose a visually-hidden CSS pattern when sighted users should not see the content but screen-reader users should still receive it. If the content should not be generated at all, remove it in the template, PHP, or other source layer instead.

What display: none actually does

Applying display: none means the element is not rendered, takes no layout space, and its descendants are ordinarily unavailable to assistive technologies. Screen readers therefore will not announce it in the normal case. MDN describes this accessibility consequence explicitly: using a display value of none removes an element from the accessibility tree.

That behavior is appropriate for content that is temporarily or conditionally unavailable to every user—for example, a closed dialog, an inactive panel, or an optional form section that does not apply to the current selection. When JavaScript changes the state, update the related controls and focus as well as the CSS so keyboard and assistive-technology users experience the same state.

Choose the technique from the intended outcome

Technique Visual result Layout space Accessibility tree Best fit
display: none Not rendered Removed Ordinarily removed Content is unavailable to everyone in this state
visibility: hidden Invisible Usually retained Removed Hide something while preserving its layout position
Visually-hidden CSS pattern Not shown on screen Does not occupy normal layout Available to assistive technology Screen-reader text, hidden labels, and similar supporting text
aria-hidden="true" No visual change by itself No change by itself Removed Redundant or decorative content that must not be announced
Remove at source Not output None Not present The content or function should not exist for this state or user

When a visually-hidden pattern is the right answer

Use visually-hidden styling when the information is intentionally absent from the visual design but still important to non-visual users. Typical examples include an accessible name for an icon-only control, additional context for a screen-reader user, or a form label that the visual layout represents another way.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A maintained project pattern generally makes the element effectively one pixel in size, removes it from normal flow, clips its visual output, and prevents overflow. Do not use an off-screen technique blindly: if the element can receive keyboard focus, the pattern must allow it to become visible when focused. Otherwise a keyboard user may move focus to content they cannot see.

Do not use display: none or visibility: hidden for this purpose; both ordinarily remove the content from the accessibility tree.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

How visibility: hidden differs

visibility: hidden makes an element invisible while usually preserving the space it would have occupied. It also removes the element from the accessibility tree. It is therefore a layout choice, not a way to hide visual content while retaining screen-reader access. If the space should collapse, use display: none; if the text must remain available to assistive technology, use a visually-hidden pattern instead.

What aria-hidden="true" does—and does not do

aria-hidden="true" changes exposure to the accessibility API; it does not hide anything visually and does not alter layout. It can be useful for decorative icons or duplicate text that would otherwise be announced twice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Never put aria-hidden="true" on a focusable element.
  • Do not put it on an ancestor that contains focusable descendants; those controls would remain reachable but unavailable to assistive technology.
  • Do not add it routinely to an element already hidden with display: none. CSS has already removed that content from the accessibility tree, so the ARIA attribute is unnecessary.

When removing the markup at the source is better

If a feature should not be present for the current user or state, omit it while generating the page. Source-level removal avoids sending unused markup and prevents scripts, styles, and focus management from having to account for an element that should not exist.

The archived CSS-Tricks question about hiding an unwanted bbPress form illustrates this distinction: the poster ultimately reported finding a PHP-based solution through a child theme. That is a historical outcome, not a current, version-specific bbPress recipe. For a modern site, use the platform’s supported template, hook, permission, or feature setting when one exists; otherwise, a theme or application-layer change may be more appropriate than a CSS-only workaround.

A practical decision checklist

  1. Should anyone receive or interact with the content in this state? If no, remove it at the source when practical, or use display: none for a client-side state.
  2. Should screen-reader users receive it even though sighted users do not see it? Use a maintained visually-hidden pattern.
  3. Must the element’s former space remain? Consider visibility: hidden, remembering that it is still absent from the accessibility tree.
  4. Is the content merely decorative or duplicated? aria-hidden="true" may be appropriate, but only when no focusable descendant is hidden from assistive technology.
  5. Can the state change dynamically? Keep visibility, focus, keyboard access, and accessible names synchronized; hiding pixels alone does not complete the interaction design.

Common mistakes

  • Using CSS to solve a source problem: If unwanted markup is always generated, investigate the template, configuration, or server-side condition rather than permanently hiding it.
  • Assuming invisible means accessible: visibility: hidden is not a screen-reader-friendly alternative to display: none.
  • Hiding a focused control: Before collapsing a panel or dialog, move focus to a logical, visible control and restore it appropriately when the component reopens.
  • Combining conflicting mechanisms: A visually-hidden element should not also receive aria-hidden="true" if assistive technologies are meant to read it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Bottom line for the CSS-Tricks question

display: none is the right quick fix only when the form or element should be unavailable to both visual and assistive-technology users. If the form should not be output for that page or user, change the PHP, template, or supported feature configuration. If only the visual presentation should change while the information remains meaningful to screen readers, use a carefully implemented visually-hidden pattern instead.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.