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:

  1. <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 (X)HTML, Accessibility, Quick Tips

Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.