The :dir CSS pseudo-class matches elements based on the directionality of the text contained in it. Pseudo-class :dir() is not equivalent of using the [dir=…] attribute selector. The latter matches a value of the dir and doesn't match when no attribute is set, even if in that case the element inherits the value of its parent. On the other hand, :dir() will match the value calculated by the UA, being inherited or the auto value.



Specification link

Specification being incubated in a Community Group

Status in Chromium


In development (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.


Last updated on 2021-12-20