:dir()

A pseudo-class that targets elements based on the directionality of the text within them (e.g., left-to-right or right-to-left).

Quick example

blockquote:dir(rtl) {
  /* Specific styling for right-to-left blockquotes */
  border-right: 5px solid #ccc;
  padding-right: 20px;
}

:dir() Browser Support

Newly available Since 2023 87% global usage

Since 2023 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Works in all modern browsers. May need a fallback for older browsers.

120+
49+
16.4+
120+
ESC