:dir()Baseline · Widely available
The :dir() CSS functional pseudo-class matches elements by text direction, either right to left (rtl) or left to right (ltr).
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Dec 7, 2023. Widely available since Jun 7, 2026.
Browser support
DesktopChrome
1–119Not supported
120+Supportedsince Dec 5, 2023
Current: 155Edge
12–119Not supported
120+Supportedsince Dec 7, 2023
Current: 154Firefox
1–48Not supported
49+Supportedsince Sep 20, 2016
Current: 157Safari
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27MobileChrome Android
18–119Not supported
120+Supportedsince Dec 5, 2023
Current: 155Firefox Android
4–48Not supported
49+Supportedsince Sep 20, 2016
Current: 157Safari iOS
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: :dir.
Feature detection
CSS · check before using
@supports selector(:dir(*)) {
/* styles that use :dir(*) */
}
/* or in JavaScript */
if (CSS.supports("selector(:dir(*))")) {
// use it
}