W3C验证错误:“NET-enabled start-tag不会立即跟随null end-tag”等

时间:2011-10-04 14:00:34

标签: css xhtml w3c-validation

我有以下代码在验证时给我错误:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head>
    <meta http-equiv="Content-Language" content="en-us" />

    <title>Welcome</title>

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />  
    <meta name="description" content="something..." />
    <meta name="keywords" content="a,b,c,d" />

    <link rel="stylesheet" type="text/css"  href="/style.css" />

</head>

以下是验证器如何解析它:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<title>Welcome</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="description" content="something..." />
<meta name="keywords" content="a,b,c,d" />
<link rel="stylesheet" type="text/css" href="/style.css" /style.css />
</head>

是什么让网站在标记中添加额外的和未加引号的“/style.css”?我怎么能避免这个?

感谢。

1 个答案:

答案 0 :(得分:0)

您可能偶然添加了/style.css(我无法生成您的结果)。

访问验证人:http://validator.w3.org/#validate-by-input

复制粘贴以下代码的内容:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head>
    <meta http-equiv="Content-Language" content="en-us" />

    <title>Welcome</title>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><!-- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> -->  
    <meta name="description" content="something..." />
    <meta name="keywords" content="a,b,c,d" />

    <link rel="stylesheet" type="text/css"  href="/style.css" />

</head>
<body></body></html>

结果: 上传的文档已成功检查为XHTML 1.0 Strict。