w3c检测报错。菜鸟求教

xiaoying2004 2006-05-24 09:59:43

刚学用w3c标准做网页,不过哪怕是最简单的代码检测也报错。忘高手指教。
下面是代码1。我在http://validator.w3.org/检测。结果出现一个错误

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>aa</title>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
</head>
<body>
ff
</body>
</html>



错误提示:
Below are the results of attempting to parse this document with an SGML parser.

Error Line 2, column 12: there is no attribute "XMLNS" .
<html xmlns="http://www.w3.org/1999/xhtml">


请问错在哪里?我可是照着教程原样照搬的啊。



加了<link href="style.css" type=text/css rel=stylesheet>一句后,出现了3个错误

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>aa</title>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<link href="style.css" type=text/css rel=stylesheet>
</head>
<body>
ff
</body>
</html>

Below are the results of attempting to parse this document with an SGML parser.

Error Line 2, column 12: there is no attribute "XMLNS" .
<html xmlns="http://www.w3.org/1999/xhtml">


Error Line 7, column 6: end tag for element "HEAD" which is not open .
</head>

Error Line 8, column 5: document type does not allow element "BODY" here .
<body>

请问错在哪里?



...全文
212 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoying2004 2006-05-25
  • 打赏
  • 举报
回复
承蒙指教
ddcatlee 2006-05-24
  • 打赏
  • 举报
回复
你的doctype定义的是什么?
如果是html,不需要定义<html xmlns="http://www.w3.org/1999/xhtml">

建议你使用
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

属性要用引号括起来。
http-equiv=Content-Type ==〉http-equiv="Content-Type"
<link href="style.css" type=text/css rel=stylesheet> 这里也是
ImN1 2006-05-24
  • 打赏
  • 举报
回复
你用的是xmlns xml的命名空间
link没有结束
改动2之后应该3就没有问题

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧