Validation Error: Element hr not allowed as child of element ul in this context. (Suppressing further errors from this subtree.)

Validation Error: Element hr not allowed as child of element ul in this context. (Suppressing further errors from this subtree.)

我在 HTML Validator site 上遇到以下错误。

这是我收到的错误消息:

Element hr not allowed as child of element ul in this context. (Suppressing further errors from this subtree.)

这是我的 html 代码:

<nav>
    <ul>
        <li><a href="index.php">Home</a></li><hr>
        <li><a href="displayallbooks.php">Display All Books</a></li><hr>
        <li><a href="searchbooksform.php">Search Books</a></li><hr>
        <li><a href="credits.php">Credits</a></li><hr>

    </ul>   
</nav>

如有任何帮助,我们将不胜感激。谢谢。

基于 HTML 验证器,我在问题下方的评论和我在 Jsfiddle 上的尝试,将您的代码更改为:

<nav>
    <ul>
        <li><a href="index.php">Home</a><hr/></li>
        <li><a href="displayallbooks.php">Display All Books</a><hr/></li>
        <li><a href="searchbooksform.php">Search Books</a><hr/></li>
        <li><a href="credits.php">Credits</a><hr/></li>
    </ul> 
</nav>

我在 HTML validort 网站上使用的源代码是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>t</title>
</head>
<body>
    <ul>
        <li><a href="index.php">Home</a><hr/></li>
        <li><a href="displayallbooks.php">Display All Books</a><hr/></li>
        <li><a href="searchbooksform.php">Search Books</a><hr/></li>
        <li><a href="credits.php">Credits</a><hr/></li>
    </ul> 
</body>
</html>

它给了我零错误。使用您的标签 nav,验证者投诉此标签。