HTML hidden Global Attribute
The hidden attribute hides an element that is not relevant right now. With the value until-found, the content stays hidden but can be revealed by find-in-page.
Description
The hidden HTML global attribute indicates that the content of an element is not relevant at the moment and should not be displayed. It can be used on any HTML element.
The attribute has two states. hidden (or an empty value) hides the element completely, like display: none, and also hides it from assistive technologies. hidden="until-found" hides the content too, but it can still be found by the browser's find-in-page feature and reached through a URL fragment: when a match is found, the browser fires the beforematch event, removes the attribute and scrolls to the content.
Because hidden works through the browser's default styles, a CSS display value set by the page (for example display: flex) overrides it. Add [hidden] { display: none !important; } if this is a problem.
When the hidden attribute is present, the browser will not render the element. This can be useful for hiding elements that are not yet relevant, such as a login form that is only displayed when a user is not logged in.
The hidden attribute can also be used to hide elements dynamically. For example, you could use JavaScript to remove the hidden attribute from an element when a user clicks a button. This would make the element visible to the user.
Here is an example of how to use the hidden attribute:
<div hidden>
This element is hidden.
</div>
You can also use the hidden attribute to hide elements based on the state of the page. For example, you could hide a login form when a user is logged in:
<form hidden id="login-form">
...
</form>
Then, in JavaScript, you could remove the hidden attribute from the login-form element when a user logs out:
function logout() {
document.getElementById('login-form').removeAttribute('hidden');
}
An accordion section that stays searchable:
<div hidden="until-found">Text that find-in-page can reveal.</div>
Syntax
<element hidden="hidden | until-found">
Values
- hiddenHides the element. An empty value or no value has the same meaning.
- until-foundHides the element, but lets find-in-page and fragment navigation reveal it. Supported in Chrome and Edge 102, Opera 88, Samsung Internet 19, Safari 26.2 and Firefox 148 (earlier versions of Firefox, from 139, had partial support).
Example
Browser Support
The following information will show you the current browser support for the HTML hidden global attribute. Hover over a browser icon to see the version that first introduced support for this HTML global attribute.
Desktop





Tablets & Mobile





