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.
# Syntax
Copy
:dir(direction) {
/* declarations */
}
# Example
Copy
:dir(ltr) {
color: red;
}
:dir(rtl) {
color: blue;
}
While elements with ltr will have a red color, rtl elements will have a blue color.
# 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
For future browser support information, also check out caniuse.com (Dir pseudo-class).
# Usage statistics (Alexa Top 1,250,000 sites)
Due to an extreme price increase of our statistics provider the data collection was stopped in September 2018.
Please wait a moment, the comments start loading now...