: Which method is the best to specify the language of a page? There seems to be two ways to specify the language of a page: <meta http-equiv="Content-Language" content="en-us"> and <html
There seems to be two ways to specify the language of a page:
<meta http-equiv="Content-Language" content="en-us">
and
<html lang="en-us">
Which one is the preferred way? I know I could just add both tags but I'd rather not have duplicate content.
Also do both methods use the same locale format (i.e. "en-us" and not "en_US")?
More posts by @XinRu657
2 Comments
Sorted by latest first Latest Oldest Best
HTML 4 and below:
<meta http-equiv="Content-Language" content="en-us">
HTML 5 +
<html lang="en-us">
The second one is the preferred way. www.w3.org/TR/html5/semantics.html The first one is "non-conforming". I couldn't find an exact definition of what that means, but I think it means, "it may work, but you can't rely on it".
They both use the format defined in BCP47, which uses a dash, not an underscore.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.