Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML meta tag for content language

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"> 
like image 924
byneri Avatar asked Dec 11 '10 17:12

byneri


People also ask

What is content type meta tag?

The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data. <meta> tags always go inside the <head> element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings.

How do you indicate language in HTML?

In a nutshell. Always add a lang attribute to the html tag to set the default language of your page. If this is XHTML 1. x or an HTML5 polyglot document served as XML, you should also use the xml:lang attribute (with the same value).

How do you serve a page with content in multiple languages in HTML?

To change the language, just simply set the lang attribute. We can define it anywhere in the document, such as in the body, in the paragraph, in the heading, or in the span tag. But the best practice is to set the lang in the span tag.


1 Answers

<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"> 
like image 187
Quentin Avatar answered Oct 05 '22 06:10

Quentin