dir
dir
This page has been flagged with the following issues:
High-level issues:
W3C Recommendation
Summary
Global attribute. Specifies the element’s text directionality.
| Applies to | ? |
|---|
dir = "ltr" or "rtl" or "auto"
Examples
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.
HTML
<!DOCTYPE html> <html lang="ar" dir="rtl"> <head> ...
View live exampleTo make the exclamation mark appear to the left of the citation, surround the citation with markup and add a dir attribute.
HTML
<p>The title is "<span dir="rtl" lang="ar" xml:lang="ar">مفتاح معايير الويب!</span>" in Arabic.</p>
Notes
Remarks
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:
- Text direction
- Setting up a right-to-left page
- Setting direction on block elements
- Mixing text direction inline
- Handling parentheses and other mirrored characters
Syntax
Compatibility
Desktop
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? |
Mobile
| Feature | Android | BlackBerry | Chrome for mobile | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Opera Mini | Safari Mobile |
|---|---|---|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? | ? | ? | ? |
See also
Related pages (MSDN)
aabbracronymaddressareabbdobigblockQuotebodybuttoncaptioncentercitecodecolcolGroupcustomdddeldfndirdivdldtemembedfieldSetfontformhnhtmliimginput type=buttoninput type=checkboxinput type=fileinput type=imageinput type=passwordinput type=radioinput type=resetinput type=submitinput type=textinskbdlabellegendlilistingmapmarqueemenunoBRobjectoloptGroupoptionpplainTextpreqrtrubyssampselectsmallspanstrikestrongsubsuptabletBodytdtextAreatFootthtHeadtrttuulvarxmpReferencedirectionConceptualHTML 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]
This tool helps to make and review comments inline.
How to Use
insert instructions, with images, here