The WebPlatform project has been discontinued when the Stewards partnership agreement ended in September 2015. This site has been frozen, and the assets we have created will remain.


Jump to: navigation, search


This article is Not Ready.

W3C Recommendation


Global attribute. Specifies the element’s text directionality.

Applies to  ?

dir = "ltr" or "rtl" or "auto"

Internationalization topics related to the dir attribute:


For pages in Arabic, Hebrew, Persian, Thaana, Urdu, etc. set the default direction of the page to right-to-left by including dir in the html tag.


<!DOCTYPE html>
<html lang="ar" dir="rtl">

To make the exclamation mark appear to the left of the citation, surround the citation with markup and add a dir attribute.


<p>The title is "<span dir="rtl" lang="ar" xml:lang="ar">مفتاح معايير الويب!</span>" in Arabic.</p>

View live example



Unless explicitly set, the dir property has no return value when accessed in script. The property does not affect alphanumeric characters in Latin documents. These characters always render ltr. However, the property does affect punctuation characters in Latin documents. For example, punctuation marks such as periods and question marks render to the left of a sentence when the dir property is set to rtl. The real benefit of this attribute is when using rtl languages such as Arabic and Hebrew. These can be some of the most challenging languages to write HTML with especially because html in itself is a left-to-right programming language.

For more information see the following links:


See also

Related pages (MSDN)

  • a
  • abbr
  • acronym
  • address
  • area
  • b
  • bdo
  • big
  • blockQuote
  • body
  • button
  • caption
  • center
  • cite
  • code
  • col
  • colGroup
  • custom
  • dd
  • del
  • dfn
  • dir
  • div
  • dl
  • dt
  • em
  • embed
  • fieldSet
  • font
  • form
  • hn
  • html
  • i
  • img
  • input type=button
  • input type=checkbox
  • input type=file
  • input type=image
  • input type=password
  • input type=radio
  • input type=reset
  • input type=submit
  • input type=text
  • ins
  • kbd
  • label
  • legend
  • li
  • listing
  • map
  • marquee
  • menu
  • noBR
  • object
  • ol
  • optGroup
  • option
  • p
  • plainText
  • pre
  • q
  • rt
  • ruby
  • s
  • samp
  • select
  • small
  • span
  • strike
  • strong
  • sub
  • sup
  • table
  • tBody
  • td
  • textArea
  • tFoot
  • th
  • tHead
  • tr
  • tt
  • u
  • ul
  • var
  • xmp
  • Reference
  • direction
  • Conceptual
  • HTML Character Sets


This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]