These attributes help to support different languages and character sets in web pages and are
Support of these attributes is at different levels in different browsers so, character set should be specified. These attributes are also called as the i18n attributes, due to the draft name on which it is defined.
It indicates direction of text flow i.e. left to right or right to left. It can be used on elements to change the direction of that portion of the document and to change directionality of a whole document then use this attribute in <html> element. Its usage is
It can have two values as
|ltr||Left to right (default)|
|rtl||Right to left|
It tells the language used in a web page and used for compatibility with older versions of HTML, and now ‘xml: lang’ attribute is used. Hence, both ‘lang’ and ‘xml:lang’ attributes to be used for maximum compatibility.
It has low effect in browsers but mainly used for search engines to tell the language of web page is made in. It can be applied to the content of a specific element if used on it but to apply on whole document it is used on <html> element.
Its values are described by ISO-639 standard consisting of two-character language codes and with a dash and a sub-code name for any further dialect. The table that follows offers some examples.
|en-us||U. S. English|
It is used in webpage as
<title>English Language Page</title>
This page is using English Language
The xml:lang Attribute
It replaces the ‘lang’ attribute and supports all languages that are written in XML so, it has ‘xml:’ characters prefixed. Its value is same as of ‘lang’ attribute i.e. an ISO-639 code.
It is used as
XML-aware applications and search engines use it. If applied to <html> element then it applies to whole web page and if used with specific elements it just applies to content of that element.