

Set the dir attribute to auto on forms and inserted text in order to automatically detect the direction of content supplied at run-time. Avoid HTML attributes with values of 'right' and 'left'. to make it easy to manage direction changes during localisation. But do use logical ('end' and 'start') on properties or values related to margins, padding, alignment, etc. Never use CSS to apply the base direction. If the overall document direction is right-to-left, add dir="rtl" to the html tag.īelow the html tag, only use the dir attribute on structural elements on the rare occasions when the base direction needs to change in order for the text to display correctly. Many different languages are written with these scripts, including Arabic, Dhivehi, Hebrew, Mandinka, Pashto, Persian, Pular, Sindhi, Syriac, Urdu, Yiddish, etc. It is essential to support languages that use right-to-left scripts such as Adlam, Arabic, Hebrew, N'Ko, Syriac, and Thaana.

The dir attribute is used to set the base direction of text for display. It also describes some other elements and attributes related to direction. at the document level and for elements like paragraphs, tables and forms.įor handling bidirectional text with inline markup you should read the separate article, Inline markup and bidirectional text in HTML. This article looks at ways of handling text direction for structural markup in HTML, ie.
