Websites, finance, economy and my life.
« »
December 15, 2007Web

通不过W3C验证最常见的网页标准错误

刚才到W3C网站验证了一下www.geniusy.com,网站竟然起初有100多处错误,其中有些是由于疏忽导致的,比如多了</p></strong>标记,有<li>而之前没有<ul>或<ol>等,不过有些就是由于以前不清楚标准导致的,比如<img>必须包含alt说明等。

不过查出来错误最多的还是Sablog的JS调用标签,一段标签都N个错误,看来得避免使用JS调用啊。下面是找来的最容易出现的错误:


HTML Tag Error PSU Pilot Frequency
<img>, <area> Required attribute ALT not specified 29.9%
<table>, <tr>, <th>, <td> There is no attribute BGCOLOR | HEIGHT | WIDTH | ALIGN 10%
<ul>, <ol> Start tag for “LI” omitted, but its declaration does not permit this 8.6%
Any HTML tag Document type does not allow element <tag> here 6.2%
<font> Element “FONT” is undefined 4.5%
The align attribute on any tag There is no attribute “ALIGN” 3.8%
<script>, <style> There are three commons types of errors on these tags:

  • There is no attribute “LANGUAGE”
  • Required attribute “TYPE” not specified
  • Many strange markup errors occurring within a <script> or <style> element
3.5%
All HTML tags End tag for <tag> omitted, but OMITTAG NO was specified. 3.4%
Page content and all tags using URLs in attribute values This error can be presented several ways, based on the validator being used, such as:

  • Cannot generate system identifier for general entity “variable”
  • General entity “variable” not defined and no default entity
  • Reference to entity “variable” for which no system identifier could be generated
  • Invalid entry was found in the value for the “href” or “src” attribute
  • Character “&” is the first character of a delimiter but occurred as data
3.4%
Any attribute value on any tag An attribute value must be a literal unless it contains only name characters 3.3%
Any series of tags End tag for “tag1″ omitted, but OMITTAG NO was specified – AND – End tag for “tag2″ which is not open 3.0%
<body> There is no attribute:

  • bgcolor
  • text
  • bgcolor
  • link
  • vlink
  • alink
2.9%
<b>, <i>
  • Use <strong> rather than <b> for emphasis
  • Use <em> rather than <i> for emphasis
2.8%
<!DOCTYPE> DOCTYPE errors can be found in the following forms:

  • No DOCTYPE found!
  • No document type declaration; implying “<!DOCTYPE HTML SYSTEM>”
  • Unknown parse mode
  • DOCTYPE is not a recognized DOCTYPE and may not be valid
2.4%
Content: &128;-&159; Found an illegal character reference or Character “&” is the first character of a delimiter but occurred as data 1.8%
<hr> align, noshade, size, and width attributes for <hr> are all deprecated in favor of style sheets 1.3%
<ul>, <ol>, <li> This error can appear in multiple ways, depended on the validator and the context in which it is contained:

  • Document type does not allow element “ul” or “ol” here; assuming missing “li” or “ol” start-tag
  • Document type does not allow element “li” here; missing one of “ul”, “ol”, “menu”, “dir” start-tag
  • End tag for “li” omitted, but OMITTAG NO was specified
  • Nested lists should be contained in an “li” tag
1.1%
<img> height and width attributes should be used with the <img> element 1.0%
<body> Document type does not allow element “body” here 0.4%
id and name attribute on any tag ID or name attribute already defined 0.2%
<center> <center> is deprecated 0.1%

Random Posts

日志信息 »

该日志于2007-12-15 05:10由 geniusy 发表在Web分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

1条评论

  1. 工作服 says:

    博主写的不错,谢谢分享,支持

发表评论 »

返回顶部