HTML inert Global Attribute
Description
The inert attribute in HTML is a global attribute that you can use with any element. It essentially makes that element and all its content inactive, meaning users can't interact with it and assistive technologies like screen readers will ignore it.
Here's a breakdown of what inert does:
- Stops user interaction: The element and its content cannot be clicked, focused, selected or edited, and are not found by the browser's find-in-page feature. Scripts can still change it and dispatch events to it.
- Hides from assistive tech: Screen readers and other tools won't announce or navigate to the inert content.
- Removes from accessibility tree: The element is excluded from the accessibility tree, which helps assistive technologies understand the page structure.
Think of inert as a way to temporarily turn off a section of your webpage. It's useful for things like:
- Modal windows: When a modal window is open, you can make the rest of the page inert to prevent users from accidentally interacting with it.
- Content that's loading or disabled: You can use
inerton content that's still loading or is currently unavailable. - Off-screen panels: Content such as a closed slide-out menu or the slides of a carousel that are not shown, so that keyboard users cannot tab into it.
It's important to note that inert is generally used for larger sections of content. For individual controls that you want to disable, consider using the disabled attribute. Browsers do not style inert content differently, so make it visually clear that it is unavailable. A modal <dialog> opened with showModal() makes the rest of the page inert automatically.
Syntax
<element inert>
Values
- No Values
Example
Browser Support
The following information will show you the current browser support for the HTML inert global attribute. Hover over a browser icon to see the version that first introduced support for this HTML global attribute.
Desktop





Tablets & Mobile





