CSS Selector Level 4 » Dir pseudo-class

The dir pseudo-class will match elements by its directionality determined by the document language. Currently ltr and rtl are common values - while ltr stands for left-to-right and rtl for right-to-left.


:dir(direction) {
    /* declarations */


:dir(ltr) {
    color: red;

:dir(rtl) {
    color: blue;

While elements with ltr will have a red color, rtl elements will have a blue color.

Try example in CodePen

Browser support

Platform Chrome Firefox Safari Edge Internet Explorer Opera
Desktop No Yes (17) No No No No
Mobile No Yes (49) No No No No

Usage statistics (Alexa Top 1,250,000 sites)

Please wait a moment, the comments start loading now...