HTML5 <html> attributes xmlns, lang, xml:lang

ma11hew28 picture ma11hew28 · Dec 1, 2010 · Viewed 40.2k times · Source

I don't understand the HTML5 specifications for the lang and xml:lang attributes of the opening <html> tag. Scrolling up a bit, I understand that xmlns is a "talisman" (has no effect), but what about lang and xml:lang? Should they be used? If so, what should they be set to?

Answer

Pointy picture Pointy · Dec 1, 2010

Everything I've seen and heard suggests that you should stick to

<!DOCTYPE html>
<html>
  <head>
    <meta charset='UTF-8'>

(or whatever character set you actually want). If you want a language associated with the page you can use the "lang" attribute on the <html> tag.

Since HTML5 is not XML, really, I personally would find it weird to use any xml: namespace stuff.