inert
Disables interaction with an element and its descendants: clicking, focus and screen readers.
- Applies to
- All HTML elements
Example
#<style>
[inert] { opacity: 0.45; }
</style>
<section>
<p>Step 1: enter your name</p>
<input placeholder="Your name">
</section>
<section inert>
<p>Step 2: choose a course (finish step 1 first)</p>
<button type="button">HTML and CSS</button>
<button type="button">Python</button>
</section>Definition and usage
#The boolean inert attribute makes a part of the page “dead”: nothing in it can be clicked, focused with the Tab key or searched, and screen readers skip it. The element is still visible, though.
It is useful when part of the interface is temporarily unavailable: the content under an open side panel, a form while it is being submitted, or wizard steps the user has not reached yet.
The browser does not change the appearance of such a part, so it is worth adding your own style, for example reduced opacity, so the user knows it cannot be used.
Syntax
#<element inert>…</element>Browser support
#Widely available · since 2023
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- A modal
<dialog>opened withshowModal()makes the rest of the page inactive on its own, so you do not need to addinertby hand. - Do not mark content the user has to read as
inert. Screen readers will not read it.
Related entries
#- hiddenHides an element: the browser neither displays nor exposes it.
- tabindexDecides whether an element can be focused with the Tab key and in what order.
- <dialog>A dialog or modal window: a confirmation, form, or message shown above the rest of the page.
- popoverTurns an element into a pop-up opened by a button, without JavaScript.
Spotted a mistake or missing an example? Write to us.