Html invalid validation

爷,独闯天下 提交于 2019-12-25 05:23:17

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!