Pregunta

Here is my HTML5 code.

<!DOCTYPE html>
<html lang="en">
   <head>
      <title>Fresh Pizza</title>
      <meta charset="utf-8"/>
      <link rel="stylesheet" href="styles/style.css" type="text/css" />
   </head>
   <body class="body">
      <header class="mainHeader">
         <img src="images/logo.jpg" alt="Logo">
         <nav>
            <ul>
               <li class="active"><a href="#">Home</a></li>
               <li><a href="#">Menu</a></li>
               <li><a href="#">About Us</a></li>
               <li><a href="#">Contact Us</a></li>
            </ul>
         </nav>
      </header>
      <div class="mainContent">
         <div class="content">
            <img src="images/home.jpg" alt="Fresh Pizza">
            <article class="bottomContent">
               <content>
                  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
               </content>
            </article>
         </div>
      </div>
      <aside class="boxOne">
         <img src="images/freshestPizza.jpg" alt="The Freshest Pizza">
      </aside>
      <aside class="boxTwo">
         <img src="images/tastiestPizza.jpg" alt="The Tastiest Pizza">
      </aside>
      <footer class="mainFooter">
         <p>&copy; 2014 Fresh Pizza.All Rights Reserved</p>
      </footer>
   </body>
</html>

I have used the following website to validate the code. http://html5.validator.nu

Once I validate it I received the following error.


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

From line 24, column 16; to line 24, column 24

<content>↩

Content model for element article:

Flow content.

Please help me.I'm new to html5.Thank you.

By the way how can I validate html5 using w3c validator?Seems like it only validates html 4.01.

¿Fue útil?

Solución

<content> is not a valid HTML tag, which is why it's not validating. If you need it for some other purpose, such as finding that block using JS, consider replacing those tags with <div> and setting a class or id.

To answer your other question, the W3C validator does indeed provide HTML5 validation, although it is listed as experimental. Your current document should be detected as HTML5, but you can expand the More Options link and select HTML5 as the Document Type.

Otros consejos

It's saying that you can't have <content></content> tags inside <article></article> tags. Actually, there is no such thing as<content></content> tags.

Instead of using that, you could replace it with <div class="content"></div>, or just remove them and replace them with nothing.

 <article class="bottomContent">
               <content>  //remove this
                  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
               </content>   //and remove this
            </article>

View all the html elements here http://www.w3schools.com/tags/default.asp

notice how there is no content tags.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top