:dir() is a CSS pseudo-class that selects elements based on the direction of the text in them. :dir() only respects the semantic direction, i.e. the one set in the document itself. It does not take into account the styled direction, i.e. set by CSS rules, such as direction.


element:dir(ltr | rtl) {
  property: value;