简体   繁体   English

W3验证程序错误帮助。 对我来说似乎没有错的错误

[英]W3 validator errors help. Errors that do not seem to be wrong to me

first time here and hopefully I can get some help before the end of the day but. 第一次来这里,希望我能在一天结束前得到一些帮助。 I ran my webpage and everything seemed to be fine and I was asked to put different portions into different elements. 我运行了网页,一切似乎都很好,并被要求将不同的部分放入不同的元素中。 However, when I ran it in the validator it gave me several errors: 但是,当我在验证器中运行它时,它给了我几个错误:

Start tag head seen but an element of the same type was already open. 看到起始标签头,但是相同类型的元素已经打开。
Stray end tag head. 杂散末端标签头。
Start tag body seen but an element of the same type was already open. 看到了开始标签正文,但是相同类型的元素已经打开。

    <!DOCTYPE html>
<html>
<title>JavaJam Coffee House</title>
  <head>
    <h1> JavaJam Coffee House</h1>
  </head>
  <body>
  <nav>
  <a href="index.html">Home</a>&nbsp;
  <a href="menu.html">Menu</a>&nbsp;
  <a href="music.html">Music</a>&nbsp;
  <a href="jobs.html">Jobs</a>&nbsp;<br>
  </nav>
  <ul>
        <li>Specifalty cofee and Tea</li>
        <li>Bagels, Muffins, and Organic Snacks</li>
        <li>Music and Poetry Readings</li>
        <li>Open Mic Night</li>
    </ul>



  <div>12312 Main Street<br>
  Mountain Home, CA 93923<br>
  1-888-555-5555</div><br>

  <footer><small><i>Copyright &copy; 2014 JavaJam Coffee House<br>
  <a href="mailto:robert@scott.com">robert@scott.com</a></i></small></footer>



  </body>
</html>

If you can help or explain, it would be appreciated 如果您可以帮助或解释,将不胜感激

Your TITLE needs to be in the HEAD section. 您的TITLE必须在HEAD部分。 With it outside like that you are inferring a second HEAD section which is unacceptable. 像在外面一样,您正在推断第二个HEAD部分,这是不可接受的。

Also the H1 should be removed from the HEAD section and placed in the BODY section. 同样,应从头部分中取出H1,并将其放置在主体部分中。

I think you may have confused the HEAD section of the document with the HEADER tag. 我认为您可能已经将HEADER标签与文档的HEAD部分混淆了。

 <!DOCTYPE html> <html> <head> <title>JavaJam Coffee House</title> </head> <body> <header> <h1> JavaJam Coffee House</h1> <nav> <a href="index.html">Home</a>&nbsp; <a href="menu.html">Menu</a>&nbsp; <a href="music.html">Music</a>&nbsp; <a href="jobs.html">Jobs</a>&nbsp; <br> </nav> </header> <ul> <li>Specifalty cofee and Tea</li> <li>Bagels, Muffins, and Organic Snacks</li> <li>Music and Poetry Readings</li> <li>Open Mic Night</li> </ul> <div>12312 Main Street <br>Mountain Home, CA 93923 <br>1-888-555-5555 </div> <br> <footer><small><i>Copyright &copy; 2014 JavaJam Coffee House<br> <a href="mailto:robert@scott.com">robert@scott.com</a></i></small> </footer> </body> </html> 

With corrections to the structure of the document, and added <header> , which I think is what you were getting at with <head> : 对文档的结构进行了更正,并添加了<header> ,我认为这正是您使用<head>遇到的问题:

<!DOCTYPE html>
<html>

<head>
  <title>JavaJam Coffee House</title>
</head>

<body>
  <header>
     <h1> JavaJam Coffee House</h1>
     <nav>
       <a href="index.html">Home</a>&nbsp;
       <a href="menu.html">Menu</a>&nbsp;
       <a href="music.html">Music</a>&nbsp;
       <a href="jobs.html">Jobs</a>&nbsp;
       <br>
     </nav>
  </header>
  <ul>
    <li>Specifalty cofee and Tea</li>
    <li>Bagels, Muffins, and Organic Snacks</li>
    <li>Music and Poetry Readings</li>
    <li>Open Mic Night</li>
  </ul>

  <div>12312 Main Street
    <br>Mountain Home, CA 93923
    <br>1-888-555-5555
  </div>
  <br>

  <footer><small><i>Copyright &copy; 2014 JavaJam Coffee House<br>
  <a href="mailto:robert@scott.com">robert@scott.com</a></i></small>
  </footer>

</body>
</html>

<header> <头>

The HTML <header> Element represents a group of introductory or navigational aids. HTML <header>元素代表一组入门或导航帮助。 It may contain some heading elements but also other elements like a logo, wrapped section's header, a search form, and so on. 它可能包含一些标题元素,但也包含其他元素,例如徽标,包装部分的标题,搜索表单等。

For a basic explanation of HTML document structure see this website: 有关HTML文档结构的基本说明,请访问以下网站:

For a more detailed and technical explanation, see this page: 有关更详细的技术说明,请参阅以下页面:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM