Language Attributes Reference

 <  Day Day Up  >  


A main goal of the HTML and XHTML specifications is to provide better support for languages besides English. The use of other languages in a Web page might require that text direction be changed from left to right or right to left. Once supporting non-ASCII languages becomes easier, it might be more common to see documents in mixed languages. Thus, there must be a way to indicate the language in use and its formatting. The basic language attributes are summarized here to avoid redundancy.

lang

The lang attribute indicates the language being used for the enclosed content. The language is identified using the ISO standard language abbreviations, such as fr for French, en for English, and so on. RFC 1766 (http://www.ietf.org/rfc/rfc1766.txt?) describes these codes and their formats.

dir

The dir attribute sets the text direction as related to the lang attribute. The accepted values under the HTML 4.01 specification are ltr (left to right) and rtl (right to left). It should be possible to override whatever direction a user agent sets by using this attribute with the bdo element:

  <bdo dir="rtl">  Napoleon never really said  "  Able was I ere I saw Elba."  </bdo>  

Internet Explorer 5.5 and higher supports dir for the bdo element, but Netscape 6 does not.
If used with other block-level elements, such as p and div , the dir attribute might produce right-aligned text, but it will not change the actual direction of the text flow.



 <  Day Day Up  >  


HTML & XHTML
HTML & XHTML: The Complete Reference (Osborne Complete Reference Series)
ISBN: 007222942X
EAN: 2147483647
Year: 2003
Pages: 252
Authors: Thomas Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net