Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project









ATTRIBUTE:  dir

dir="direction"
 
The dir 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 Chinese 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:
 
dir="ltr"
The ltr value, which directs the text to flow from left to right, is the default.
 
dir="rtl"
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.
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl" xml:lang="he" lang="he">
<head>
<title>DevGuru XHTML dir attribute Example</title>
</head>
<body>
... place text of right to left language here ...
</body>
</html>

 
The output example is a Unicode file and may not properly display in some browsers.
 
Output:
Click to see output in a separate window


 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information