Displaying Right-to-Left Text Using HTML Tags for Globalization
When writing Web Forms pages, the best way to make text flow from right to left is to use the DIR (direction) attribute. It is usually placed in the <HTML> tag or the <BODY> tag, and then controls and HTML elements on the page inherit the specified direction.
Which tag the DIR attribute is applied to affects how the form appears:
- When direction is specified as RTL (right-to-left) in the <HTML> tag, the page will get the correct extended styles set so it displays as a right-to-left page on a bidirectional-enabled system and a vertical scrollbar appears on the left side.
- When direction is specified as RTL in the <BODY> tag, frames and captions will not inherit the right-to-left direction.
There are other ways to set the flow of text, including the <BDO> tag for bidirectional override, Unicode characters which have embedded directional information, and cascading style sheets. For more information, see Authoring HTML for Middle Eastern Content on the Global Software Development site on Microsoft.com (http://www.microsoft.com/globaldev/articles/mideast.asp).
To set the direction attribute in a Web Forms page
- In Design view, select the document. In the Properties window, set the dir property to
In HTML view, edit the <HTML> or <BODY> tag to add the DIR attribute.
<HTML dir="rtl"> <!-- Or --> <body dir="rtl" >
- In Design view, select any HTML server controls for which you wish to override the DIR attribute of the rest of the document. In the Properties window, set the dir property of those controls to
In HTML view, edit the tags of any HTML elements, HTML server controls, or Web Forms controls for which you wish to override the DIR attribute.
<TABLE dir="ltr" > <asp:TextBox dir="ltr" >