coderef

:modalBaseline · Widely available

The :modal pseudo-class selects elements that put other elements into a non-interactive state, such as a fullscreen element or a <dialog> element used with showModal().

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 2, 2022. Widely available since Mar 2, 2025.

Browser support

DesktopChrome
1–104Not supported
105+Supportedsince Sep 2, 2022
Current: 155
Edge
12–104Not supported
105+Supportedsince Sep 1, 2022
Current: 154
Firefox
1–102Not supported
103+Supportedsince Jul 26, 2022
Current: 157
Safari
1–15.5Not supported
15.6+Supportedsince Jul 20, 2022
Current: 27
MobileChrome Android
18–104Not supported
105+Supportedsince Sep 2, 2022
Current: 155
Firefox Android
4–102Not supported
103+Supportedsince Jul 26, 2022
Current: 157
Safari iOS
1–15.5Not supported
15.6+Supportedsince Jul 20, 2022
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: :modal.

Feature detection

CSS · check before using
@supports selector(:modal) {
  /* styles that use :modal */
}

/* or in JavaScript */
if (CSS.supports("selector(:modal)")) {
  // use it
}

Documentation (MDN)

Specification