css - W3C 验证错误 : "NET-enabling start-tag not immediately followed by null end-tag" and others

标签 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”?我怎样才能避免这种情况?

谢谢。

最佳答案

您可能不小心添加了 /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/

相关文章:

html - 将元素定位在 div 的底部(不是父元素)- Twitter Bootstrap v3

accessibility - ARIA 角色验证挑战

javascript - 如何使用鼠标滚轮为 div 设置线性动画?

javascript - onmouseover 影响取消 span 标签中的换行符

java - 从 Jsoup 读取内容后写入 xhtml 文件

CSS对齐/滚动条问题

javascript - 如果 `name` 属性无效,如何识别表单?

javascript - Google +1 按钮不符合 W3C 标准

html - 我的 CSS/HTML 有一个明显的重大缺陷

c# - 登录后隐藏注销链接