Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么是HTML5替代过时的元http equiv=内容语言。_Html_Validation_Content Type_Multilingual - Fatal编程技术网

什么是HTML5替代过时的元http equiv=内容语言。

什么是HTML5替代过时的元http equiv=内容语言。,html,validation,content-type,multilingual,Html,Validation,Content Type,Multilingual,我正在完成一个HTML5网站,它混合了英语和汉语 我的验证器(用于FF的HTML5验证器加载项)给了我以下错误: error: Using the “meta” element to specify the document-wide default language is obsolete. Consider specifying the language on the root element instead. At line 6, column 9: <meta http-equi

我正在完成一个HTML5网站,它混合了英语和汉语

我的验证器(用于FF的HTML5验证器加载项)给了我以下错误:

error: Using the “meta” element to specify the document-wide default
language is obsolete. Consider specifying the language on the root
element instead.

At line 6, column 9: <meta http-equiv="Content-Language" content="en-us" />
错误:使用“meta”元素指定文档范围的默认值
语言已经过时了。考虑在根上指定语言
元素。
在第6行第9列:
有关守则如下:

<!DOCTYPE html>
<html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

查看W3.org将引导我进入此页面:

我必须承认我不明白我该如何遵守这一准则

我不知道在根元素上指定语言是什么意思,或者怎么做


当然
不足以满足
UTF-8

在HTML5中,您实际上可以为每个元素定义
lang
。这意味着如果您有一个包含普通话的
div
,只需为该div定义一个属性
lang=“zh CN”
,如

有关语言和字符集设置,请参见下文

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>title</title>
.....

标题
.....

我想你找错了方向。你在链接中提到的元标记是“内容语言”,但你在这里列出的是“内容类型”。我可以为混合内容定义这两个标记吗?@Andrew-不,你不能。lang属性只接受一种语言代码。@Andrew:您要为页面选择主要(即最常用)语言,并通过
元素上的
lang
属性指示,然后将不同语言的任何内容包装在一个元素中,该元素具有指示语言的
lang
属性。使用元标记设置字符集是错误的,因为它会使浏览器使用解析文档,直到它偶然发现元标记,在这种情况下,它会使用正确的编码重新启动解析;这是一个很大的性能问题,字符集猜测是不可靠的。正确的方法是使用
内容类型
标题和正确的字符集提供文档。