W3C 验证问题

muiz 2009-06-03 09:16:48
下面代码不通过W3C验证 ( http://validator.w3.org/#validate_by_input ):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>title</title>
</head>
<body>
<img src="img/test.png" width="116" height="215" />
</body>
</html>

提示错误:
Line 8, Column 51: required attribute "alt" not specified
<img src="img/test.png" width="116" height="215" />
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

--------------------------------
大家有什么建议吗? 我不明白这个错误. 如果去掉img这个节点, 就可以通过验证.

...全文
47 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
muiz 2009-06-03
  • 打赏
  • 举报
回复
:( 谢谢
lihan6415151528 2009-06-03
  • 打赏
  • 举报
回复
alt 属性不能为空,必须填写
shenzhenNBA 2009-06-03
  • 打赏
  • 举报
回复
按信息提示,W3C要求图片的 alt 属性不能为空,必须填写,该属性是图片显示不出来时的代替文字...

61,112

社区成员

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

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