我在这里得到了w3c验证错误
The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.
One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
这是我的源代码
<ul class="link">
<li><a href="" class="selected"><span>1<div class="clr"> </div><label>Vul Postcode in </label></span></a></li>
<li><a href=""><span>2<div class="clr"> </div><label>Restaurants </label></span></a></li>
<li><a href=""><span>3<div class="clr"> </div><label>Menukaart</label></span></a></li>
<li><a href=""><span>4<div class="clr"> </div><label>Afrekenen</label></span></a></li>
</ul>
请帮我找出问题,
由于
Pallavi
答案 0 :(得分:1)
您在内联元素(div
)中有一个块元素(span
)。这是不允许的。
解决方案1:将span
更改为div
:
<a href=""><div>2<div class="clr"> </div><span class="label">Restaurants </span></div></a>
(您必须使用HTML5(<!DOCTYPE html>
),否则a
元素内不允许使用块元素。)
解决方案2:将div
更改为span
:
<a href=""><span>2<span class="clr"> </span><span class="label">Restaurants </span></span></a>
请注意,label
元素中没有a
(我在此处将label
更改为span
)。仅当您拥有label
时才使用form
元素。