Language

Description:

The language attribute indicates the language of the element referred to by the tag. You may use this attribute on any tag which surrounds text, including <HTML>, <BODY>, <P> and so on. 

This element is useful for many things, including but not limited to the following.

  • Assisting robots with indexing a page
  • Helping display the appropriate symbols for the language, such as quotation marks and such.
  • Aiding with spell and grammar checking

The format is as follows:

lang = primary-sub

where "primary" is the primary language code. These include:

Code Description
de German
el Greek
en English
es Spanish
fr French
hi Hindi
it Italian
ja Japanese
nl Dutch
ru Russian
sa Sanskrit
ur Urdu
zh Chinese

And "sub" is a subcode indicating a sub-language. For example, en-US means English of the United States dialect. All of the subcodes are defined in the ISO 3166 specification.

Examples:

<HTML lang="fr">

Indicates that the language of the entire HTML document is French.

<P lang="es">

The current paragraph is in Spanish.