问题
so I'm fairly new to HTML, and I'm making myself a simple site with html 5 and I was validation to check for errors and I got this:
Element div not allowed as child of element ul in this context. (Suppressing further errors from this subtree.)<div class="home"><a href="sitename/"><li>Home</a></li></div>
and here's the code:
<ul>
<div class="home"><a href="sitename/"><li>Home</a></li></div>
<div class="About"><a href="#"><li>About</a></li></div>
<div class="Contact"><a href="#"><li>Contact</a></li></div>
<div class="empty"><a href="#"><li> </a></li></div>
</ul>
What do I have to do to fix the errors?
回答1:
its clear
1.Line 15, Column 22: Element div not allowed as child of element ul in this context. (Suppressing further errors from this subtree.)
<div class="home"><a href="http://rexnoz.zxq.net/"><li>Home</a></li></div>
2.Error Line 15, Column 67: End tag a violates nesting rules.
<div class="home"><a href="http://rexnoz.zxq.net/"><li>Home</a></li></div>
3.Error Line 15, Column 67: Cannot recover after last error. Any further errors will be ignored.
<div class="home"><a href="http://rexnoz.zxq.net/"><li>Home</a></li></div>
what 2,3 point is that you started div
inside the li
and closed the li
fist should be div
from w3c
回答2:
Should be
<div><li><a>Home</a></li></div>
来源:https://stackoverflow.com/questions/14003588/html-invalid-validation