简体   繁体   English

W3c验证程序HTML 4.01过渡版-这里出了什么问题?

[英]W3c Validator HTML 4.01 Transitional - whats wrong here?

Here is my piece of code which gives me error: 这是我的一段代码,给我错误:

<ul>
<li>
    <div><span>Text</span></div>
    <div>
        <ul>
            <li>
              <a href="#">
                <div>Link</div>
              </a>
            </li>
        </ul>
    </div>
</li>
</ul>

An error: 一个错误:

document type does not allow element "DIV" here; 文档类型此处不允许元素“ DIV”; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag 缺少“ APPLET”,“ OBJECT”,“ MAP”,“ IFRAME”,“ BUTTON”开始标记之一

<div> elements are not allowed inside <a> elements (until HTML 5 which doesn't use DTDs and supports the transparent content model). <a>元素中不允许使用<div>元素(直到HTML 5不使用DTD并支持透明内容模型)。

(The DTD allows applet, object, map, iframe and button inside a elements, and it allows div inside all those elements, but the specification forbids the combination of those two factors in the text, it is a limitation of DTDs which is why the valdator suggests that as a fix). (DTD允许在元素内使用applet,object,map,iframe和button,并允许在所有这些元素内使用div,但规范禁止在文本中结合这两个因素,这是DTD的局限性,这就是为什么valdator建议将此作为解决方法)。

You cannot have a div (block element) inside an a (inline element). 您不能在a (内联元素)中包含div (块元素)。

<a href="#">
    <div>Link</div>
</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM