Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm just creating a new site from scratch. Each page in that site will have a default language and I'd like the markup to reflect it because there will be multiple languages.

I'm using HTML 4.01 and I'm targetting older browsers as well (e.g. IE 6, Opera 8, Lynx etc.). Regarding Cross-Browser compatibility as well as of "best practices" where to place the lang attribute: To the HTML tag or to the BODY tag or does this make no difference at all?

I'm going towards the BODY tag as it contains all the default languages text, while the HEAD might not always. But I have no clue if any browser is taking care of the lang attribute anyway. Any hints?

(or is this a question for http://doctype.com/ ?)

share|improve this question
Yeah, Doctype is the better place to ask this – John Conde Jan 27 '11 at 19:08
Okay, posted it over there as well: doctype.com/… – hakre Jan 28 '11 at 1:13
up vote 4 down vote accepted

There isn't any cross-browser compatibility issues AFAIK. But it makes the most sense and is most commonly used by putting it in html since your document isn't just limited to body. See this page for the purpose of lang and this page for the proper use of lang versus other ways of specifying language.

Since lang only specifies the language of the current element and its child elements, unless you place it in your root element (html), you're neglecting a large part of your document (what language is your title, meta description, etc.?). You can, however, add additional lang attributes in other elements further down your document tree if they are in a different language.

More documents outlining best practices:

share|improve this answer
Thanks for the detailed answer. That's basically what I thought as well but wanted to have a second opinion. Regarding the links you provided, in particular your second link to the FAQ on W3C was very helpful. Thanks a lot! – hakre Jan 28 '11 at 11:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.