w3验证html错误

时间:2012-09-26 00:46:31

标签: html xhtml

我还是个新手,我对这个错误意味着什么感到困惑。

 Line 30, Column 5: document type does not allow element "li" here; missing one of "ul", "ol" start-tag

我一直得到这个错误直到第44行

这个省略了什么意思?

 Line 54, Column 7: end tag for "div" omitted, but OMITTAG NO was specified

下面是我的代码:(谢谢,如果有人可以指导我

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" >
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content= "about" />
    <meta name="keywords" content="about" />
<title>About</title>
</head>  
    <body>
        <div id="container">
        <div id="inside">
        <div id="inside2">
        <h1>About</h1>
        <ul>
        <li>The Php version installed in mercury is <?php echo 'Current PHP version: ' . phpversion(); ?>.
        </li>
        <br />
        <li>The task I am not attempted is Task 5.
        </li>
        <br />
        <li>I am not exploring and implementing any special feature.</li>
        <br />
        <li>I have trouble mainly on Task 3 with validation.</li>
        <br />
        <li>Regarding with php, I want to gain more knowledge, I need to grasp deeper understanding on how everything works
        as there are a lot of things to remember and how things are working. The other part is I need to dramatically improve
        my time managment, although I start a week and half early, but I had trouble understanding the codes, and with other
        assignments I need to finish.</li>
        <br />
        <li>Youtube channel by the name phpacademy and thenewboston help me out to get clearer understanding about certain stuff
        in php, as well stackoverflow.com</li>
        <li>I have learn more and new codes, better understanding on how overall the code works in PHP, but still a lot to learn.</li>
        <br />
        <img src="thread.jpg" width="450" height="350" alt="Discussion Thread" />
        <br />
        <a href="index.php">Return to Homepage</a> 


        <ul>


    </body>
    </html>

5 个答案:

答案 0 :(得分:1)

您的<br/>代码正在放弃验证。删除它们,或者至少将它们放在合适的元素中。对于其他错误,请正确关闭标记。

答案 1 :(得分:0)

对于第一条消息,任何<li>必须是<ul>的子级。对于第二条消息,您打开三个<div>但从未关闭它们。 <br />也无效且多余; <li>将自动断行。您的HTML可以修复如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" >
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content= "about" />
    <meta name="keywords" content="about" />
<title>About</title>
</head>  
<body>
    <div id="container">
    <div id="inside">
    <div id="inside2">
    <h1>About</h1>
    <ul>
    <li>The Php version installed in mercury is <?php echo 'Current PHP version: ' . phpversion(); ?>.
    </li>
    <li>The task I am not attempted is Task 5.</li>
    <li>I am not exploring and implementing any special feature.</li>
    <li>I have trouble mainly on Task 3 with validation.</li>
    <li>Regarding with php, I want to gain more knowledge, I need to grasp deeper understanding on how everything works
    as there are a lot of things to remember and how things are working. The other part is I need to dramatically improve
    my time managment, although I start a week and half early, but I had trouble understanding the codes, and with other
    assignments I need to finish.</li>
    <li>Youtube channel by the name phpacademy and thenewboston help me out to get clearer understanding about certain stuff
    in php, as well stackoverflow.com</li>
    <li>I have learn more and new codes, better understanding on how overall the code works in PHP, but still a lot to learn.</li>
    <li>
        <img src="thread.jpg" width="450" height="350" alt="Discussion Thread" />
        <a href="index.php">Return to Homepage</a>
    </li>
    </ul>
</div>
</div>
</div>
</body>
</html>

答案 2 :(得分:0)

尝试在</ul>之后放置</li>。然后用<div>关闭你的上一个</div> ...我很确定应该这样做。此外,所有中断都是错误的格式化,您可以使用CSS更改这些样式,并且它将更兼容浏览器。

答案 3 :(得分:0)

检查底部的结束ul标签。 它似乎是<ul>,应该是</ul>(您有一个开始标记而不是结束标记)。

请记住XHTML 1.0严格意味着......严格。

答案 4 :(得分:0)

这应该更好地验证。

有两个开放的<ul>代码,没有一个结束标记,3 </div>个缺失,很多<br>的b / w <li>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" >
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content= "about" />
    <meta name="keywords" content="about" />
<title>About</title>
</head>
    <body>
        <div id="container">
          <div id="inside">
            <div id="inside2">
            <h1>About</h1>
            <ul>
              <li>The Php version installed in mercury is <?php echo 'Current PHP version: ' . phpversion(); ?>.</li>
              <li>The task I am not attempted is Task 5.</li>
              <li>I am not exploring and implementing any special feature.</li>
              <li>I have trouble mainly on Task 3 with validation.</li>
              <li>Regarding with php, I want to gain more knowledge, I need to grasp deeper understanding on how everything works
              as there are a lot of things to remember and how things are working. The other part is I need to dramatically improve
              my time managment, although I start a week and half early, but I had trouble understanding the codes, and with other
              assignments I need to finish.</li>
              <li>Youtube channel by the name phpacademy and thenewboston help me out to get clearer understanding about certain stuff
              in php, as well stackoverflow.com</li>
              <li>I have learn more and new codes, better understanding on how overall the code works in PHP, but still a lot to learn.</li>
            </ul>
            <img src="thread.jpg" width="450" height="350" alt="Discussion Thread" />
            <br>
            <a href="index.php">Return to Homepage</a>    
            </div>
          </div>
        </div>
</body>
</html>