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?


1 Answer 1


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:

  • 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, 2011 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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