HTML meta tag for content language

byneri picture byneri · Dec 11, 2010 · Viewed 141.6k times · Source

What is the difference between the following two HTML meta tags, for specifying spanish web page content:

<meta name="language" content="Spanish">

and

<meta http-equiv="content-language" content="es">

Answer

Quentin picture Quentin · Dec 11, 2010

<meta name="language" content="Spanish">

This isn't defined in any specification (including the HTML5 draft)

<meta http-equiv="content-language" content="es">

This is a poor man's version of a real HTTP header and should really be expressed in the headers. For example:

Content-language: es
Content-type: text/html;charset=UTF-8

It says that the document is intended for Spanish language speakers (it doesn't, however mean the document is written in Spanish; it could, for example, be written in English as part of a language course for Spanish speakers).

From the spec:

The Content-Language entity-header field describes the natural language(s) of the intended audience for the enclosed entity. Note that this might not be equivalent to all the languages used within the entity-body.

If you want to state that a document is written in Spanish then use:

<html lang="es">