Specify each HTML document’s main natural language

Always specify which natural language (spoken, written or signed human language) is used for a document’s content.

For HTML documents that only use a single natural language, specify that language by setting the lang attribute on the HTML element. If you are using XHTML, use xml:lang. If you use XHTML served as text/html (you most likely do), use both lang and xml:lang.

The natural language of most pages on this site is English, which is specified like this in HTML:

<html lang="en">

Further reading

This post is a Quick Tip. Background info is available in Quick Tips for web developers and web designers.

Posted on January 20, 2009 in Quick Tips, Accessibility, (X)HTML