HTML » HTML Core Attributes » dir

Version: 4.0


The dir core attribute is used to declare the direction that the text should run, either left to right (default) or right to left. This allows the internationalization of HTML since several important foreign languages read right to left, such as Arabic and Hebrew.

Also, see the lang core attribute that defines the language being used. However, note that using lang by itself does not specify language direction.
If used as an attribute of the HTML tag, it will apply to the entire document. When used with other tags, it only applies to the text under the influence of that tag. For example, when used with the table tag, the first column of the table will start on the right side and each additional column will be farther to the left.
This attribute should not be used to simply reverse a string. That is best done by using the VBScript StrReverse( ) function.
You may only use the following values:
The ltr value, which directs the text to flow from left to right, is the default.

The rtl value directs the text to flow from right to left.

Note that .html texts that contain foreign languages that use special characters will have to be saved as a Unicode file, rather than as an ANSI file, in order for the characters to be properly displayed. Please be aware that some browsers may not be capable of correctly displaying a Unicode file.


<html dir="rtl" lang="he">
place text of foreign language here
Language(s): HTML

See Also: