Mobile app version of vmapp.org
Login or Join
XinRu657

: 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

@XinRu657

Posted in: #Html #MetaTags

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")?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @XinRu657

2 Comments

Sorted by latest first Latest Oldest Best

 

@Jessie594

HTML 4 and below:

<meta http-equiv="Content-Language" content="en-us">


HTML 5 +

<html lang="en-us">

10% popularity Vote Up Vote Down


 

@Gretchen104

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme