我有以下代码在验证时给我错误:
<!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”?我怎样才能避免这种情况?
谢谢。
最佳答案
您可能不小心添加了 /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。
关于css - W3C 验证错误 : "NET-enabling start-tag not immediately followed by null end-tag" and others,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7649093/