The dir Attribute:
The dir attribute allows you to indicate to the browser the direction in which the text should flow.The dir attribute can take one of two values, as you can see in the table that follows:Value Meaning
ltr Left to right (the default value)rtl Right to left (for languages such as Hebrew or Arabic that are read right to left)
Example:
<html dir=rtl>
<head>
<title>Display Directions</title>
</head>
<body> This is how IE 5 renders right-to-left directed text. </body>
</html>
When dir attribute is used within the <html> tag, it determines how text will be presented within the entire document. When used within another tag, it controls the text's direction for just the content of that tag.The lang Attribute:
The lang attribute allows you to indicate the main language used in a document, but this attribute was kept in HTML only for backwards compatibility with earlier versions of HTML. This attribute has been replaced by the xml:lang attribute in new XHTML documents.When included within the <html> tag, the lang attribute specifies the language you've generally used within the document. When used within other tags, the lang attribute specifies the language you used within that tag's content. Ideally, the browser will use lang to better render the text for the user.
The values of the lang attribute are ISO-639 standard two-character language codes.Check HTML Language Codes: ISO 639 for a complete list of language codes.
Example:
<html lang=en>
<head>
<title>English Language Page</title>
</head>
<body> This page is using English Language </body>
</html>
The xml:lang Attribute:
The xml:lang attribute is the XHTML replacement for the lang attribute. The value of the xml:lang attribute should be an ISO-639 country code as mentioned in previous section.
We will see related examples as we will proceed to study other HTML tags.
No comments:
Post a Comment