HTML dir attribute


ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.

If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)

PDF mobile

The dir attribute in HTML

Sets the value of the directionality property
Directionality of text
Property name:directionality
Attribute name:dir
Attribute type:enumerated attribute

Make sure you understand the difference between an attribute and property and are familiar with the definitions of other HTML terms.

left to right
right to left
the direction is determined by the content of the element

The default value of the directionality property when the attribute is not coded on the top element is ltr (left to right). On other elements where the attribute is not coded, the value of the dir property is inherited from the parent element.

The directionality can be overridden with the <bdo> tag (bi-directional override) or the <bdi> tag (bi-directional isolation).

Valid HTML 5