Directionality :dir(ltr/rtl)
The :dir() pseudo-class represents an element based on its directionality, determined by the document language.
Browser Support
| Chrome | Firefox | Safari | Opera | IE | Edge | |
|---|---|---|---|---|---|---|
| Desktop | no | yes | no | no | no | no |
| Mobile | no | yes | no | no | no | no |
Syntax
E:dir(direction)
/* Where "direction" can either be ltr or rtl. */
}
Example
/* The following selector matches all blockquote elements with a dir attribute set to ltr. */
blockquote:dir(ltr) {
border-left: 5px solid #555;
}
/* The following selector matches all blockquote elements with a dir attribute set to rtl. */
blockquote:dir(rtl) {
border-right: 5px solid #555;
}
Information is based on Selectors Level 4 - W3C Working Draft (last updated on May 2, 2013)
Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.