所以我第一次尝试在wordpress上编写代码,但验证器似乎并不喜欢我。看看我在验证时得到的错误:
第87行,第33栏:文件类型不允许元素“li”在这里;缺少“ul”,“ol”,“menu”,“dir”start-tag
之一我到处搜索,我不知道任何丢失或错位的li或ul标签
有人可以帮我解决这个问题吗?
<!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">
<head profile="http://gmpg.org/xfn/11">
<title>
Blog</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="WordPress 2.9.2" />
<!-- leave this for stats please -->
<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/cmc-milagro/style.css" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://localhost/wordpress/?feed=rss2" />
<link rel="alternate" type="text/xml" title="RSS .92" href="http://localhost/wordpress/?feed=rss" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="http://localhost/wordpress/?feed=atom" />
<link rel="pingback" href="http://localhost/wordpress/xmlrpc.php" />
<link rel='archives' title='March 2010' href='http://localhost/wordpress/?m=201003' />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/wordpress/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/wordpress/wp-includes/wlwmanifest.xml" />
<link rel='index' title='Blog' href='http://localhost/wordpress' />
<meta name="generator" content="WordPress 2.9.2" />
</head>
<body>
<div>
<h1><a href="http://localhost/wordpress">
Blog</a>
</h1>
Just another WordPress weblog</div>
<div id="container">
<h2><a href="http://localhost/wordpress/?p=8">
Teste Post 3 </a></h2>
<div class="post" id="post-8">
<div class="entry">
<p>Aliquam erat volutpat. Fusce in nibh elit. Morbi lorem urna, viverra sed blandit eget, mattis venenatis felis. Maecenas viverra pellentesque justo, vel tincidunt massa semper sit amet. Vestibulum rhoncus purus in mauris fermentum ut aliquet augue semper.</p>
<p class="postmetadata">
Filed under: <a href="http://localhost/wordpress/?cat=1" title="View all posts in Uncategorized" rel="category">Uncategorized</a> by admin <br />
<a href="http://localhost/wordpress/?p=8#respond" title="Comment on Teste Post 3">No Comments »</a> | <a class="post-edit-link" href="http://localhost/wordpress/wp-admin/post.php?action=edit&post=8" title="Edit post">Edit</a> </p>
</div>
</div>
<h2><a href="http://localhost/wordpress/?p=5">
Teste Post 2 </a></h2>
<div class="post" id="post-5">
<div class="entry">
<p>Aliquam erat volutpat. Fusce in nibh elit. Morbi lorem urna, viverra sed blandit eget, mattis venenatis felis. Maecenas viverra pellentesque justo, vel tincidunt massa semper sit amet. Vestibulum rhoncus purus in mauris fermentum ut aliquet augue semper. Duis orci metus, cursus ac tempor eget, faucibus vel elit. Sed rutrum mollis posuere. Maecenas luctus commodo augue vel fringilla. Nunc enim lacus, varius nec tempor sed, congue vel elit. Suspendisse urna ligula, pharetra ac malesuada quis, scelerisque eget justo.</p>
<p class="postmetadata">
Filed under: <a href="http://localhost/wordpress/?cat=1" title="View all posts in Uncategorized" rel="category">Uncategorized</a> by admin <br />
<a href="http://localhost/wordpress/?p=5#respond" title="Comment on Teste Post 2">No Comments »</a> | <a class="post-edit-link" href="http://localhost/wordpress/wp-admin/post.php?action=edit&post=5" title="Edit post">Edit</a> </p>
</div>
</div>
<h2><a href="http://localhost/wordpress/?p=3">
Teste Post 1 </a></h2>
<div class="post" id="post-3">
<div class="entry">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut mattis elit. In sed nulla lobortis dolor pellentesque fringilla at eget ipsum. Proin pellentesque vehicula ultricies. Phasellus velit nunc, tempus nec scelerisque vel, euismod pellentesque diam. Vivamus consectetur, sapien sit amet rhoncus porta, sapien nisl imperdiet diam, dapibus placerat sem ante condimentum nisl. Nulla facilisi. Mauris eu turpis mauris. Nunc at turpis elit, et mattis purus. Proin varius, nunc rhoncus consectetur dignissim, lacus augue accumsan sem, nec pretium magna est a massa. Duis eu justo arcu. Curabitur diam ligula, semper non blandit ut, sodales ac dui.</p>
<p class="postmetadata">
Filed under: <a href="http://localhost/wordpress/?cat=1" title="View all posts in Uncategorized" rel="category">Uncategorized</a> by admin <br />
<a href="http://localhost/wordpress/?p=3#respond" title="Comment on Teste Post 1">No Comments »</a> | <a class="post-edit-link" href="http://localhost/wordpress/wp-admin/post.php?action=edit&post=3" title="Edit post">Edit</a> </p>
</div>
</div>
<h2><a href="http://localhost/wordpress/?p=1">
Hello world! </a></h2>
<div class="post" id="post-1">
<div class="entry">
<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>
<p class="postmetadata">
Filed under: <a href="http://localhost/wordpress/?cat=1" title="View all posts in Uncategorized" rel="category">Uncategorized</a> by admin <br />
<a href="http://localhost/wordpress/?p=1#comments" title="Comment on Hello world!">1 Comment »</a> | <a class="post-edit-link" href="http://localhost/wordpress/wp-admin/post.php?action=edit&post=1" title="Edit post">Edit</a> </p>
</div>
</div>
<div class="navigation">
</div>
</div>
<div class="sidebar">
<ul>
<li id="search">
<form method="get" id="searchform" action="http://localhost/wordpress/">
<div>
<input type="text" value="" name="s" id="s" size="15" /><br />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form> <li class="pagenav"><h2>Pages</h2><ul><li class="page_item page-item-2"><a href="http://localhost/wordpress/?page_id=2" title="About">About</a></li>
</ul></li> </li>
<li>
<h2>
Categories </h2>
<ul>
<li class="cat-item cat-item-1"><a href="http://localhost/wordpress/?cat=1" title="View all posts filed under Uncategorized">Uncategorized</a> (4)
</li>
</ul>
</li>
<li>
<h2>
Archives </h2>
<ul>
<li><a href='http://localhost/wordpress/?m=201003' title='March 2010'>March 2010</a></li>
</ul>
</li>
<li id="linkcat-2" class="linkcat"><h2>Blogroll</h2>
<ul>
<li><a href="http://wordpress.org/development/">Development Blog</a></li>
<li><a href="http://codex.wordpress.org/">Documentation</a></li>
<li><a href="http://wordpress.org/extend/plugins/">Plugins</a></li>
<li><a href="http://wordpress.org/extend/ideas/">Suggest Ideas</a></li>
<li><a href="http://wordpress.org/support/">Support Forum</a></li>
<li><a href="http://wordpress.org/extend/themes/">Themes</a></li>
<li><a href="http://planet.wordpress.org/">WordPress Planet</a></li>
</ul>
</li>
<li>
<h2>
Meta </h2>
<ul>
<li><a href="http://localhost/wordpress/wp-admin/">Site Admin</a></li> <li>
<a href="http://localhost/wordpress/wp-login.php?action=logout&_wpnonce=ee45c3c988">Log out</a> </li>
</ul>
</li>
</ul>
</div>
<div id="footer">
<p>
Copyright © 2010 Blog</p>
</div>
</body>
</html>
答案 0 :(得分:3)
第87行:
</form> <li class="pagenav"><h2>Pages</h2><ul><li class="page_item page-item-2"><a href="http://localhost/wordpress/?page_id=2" title="About">About</a></li>
此处结尾的<form></form>
位于<li>
内,距上方6行(第81行)。第87行的新<li>
打开后,<li>
尚未关闭。
在</li>
之后插入</form>
应修复它。
答案 1 :(得分:0)
<li class="pagenav"><h2>Pages</h2>
需要在<ul>
代码中 直接 。
<ul>
<li id="search">
<form method="get" id="searchform" action="http://localhost/wordpress/">
<div>
<input type="text" value="" name="s" id="s" size="15" /><br />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
<li class="pagenav"><h2>Pages</h2>
<ul>
<li class="page_item page-item-2"><a href="http://localhost/wordpress/?page_id=2" title="About">About</a></li>
</ul>
答案 2 :(得分:0)
<ul>
<li>blah
<form>....</form>
<li>...
缺少第一个列表项的结束标记。因此,您尝试将列表项创建为另一个列表项的子项。
这在HTML中很好,但在XHTML中,所有元素都必须明确关闭。
您可能打算使用此构造:
<ul>
<li>blah
<form>....</form>
</li>
<li>...