:dir(ltr/rtl)

Directionality

The :dir() pseudo-class represents an element based on its directionality, determined by the document language.

Browser Support (tested using latest versions)

Desktop
Google Chrome
No
Mozilla Firefox
No
Safari
No
Opera Browser
No
Internet Explorer
No
Mobile
Android Browser
No
Chrome for Android
No
Mozilla Firefox Mobile
No
Safari iOS
No
Opera Mobile
No
IE Mobile
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.