How HTML5 page structure affects W3C validation and SEO [closed]

别等时光非礼了梦想. 提交于 2020-01-06 14:55:57

问题


If we declare page as HTML5, Is it mandatory to follow HTML5 page structure ? . Below are two examples shows the ideal HTML5 page and page which is not following HTML5 structure.

But when i validated these two pages using w3c validator, these pages successfully checked as HTML5 without errors.

ex:

<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>

<body>
<header>
        <nav>
            <ul>
                <li>Your menu</li>
            </ul>
        </nav>
    </header>
The content of the document......

<footer>
        <p>Copyright 2009 Your name</p>
    </footer>
</body>

</html>

My page:

<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<div id="header">
    <div id="navigation">
        <ul>
            <li>Your menu</li>
        </ul>
    </div>
</div>
    The content of the document......

<div id="footer">
    <p>Copyright 2009 Your name</p>
</div>
</body>
</html>
  1. If we specify doctype as html5 do we need to make website html5 specific / do we have to maintain html5 structure ?
  2. Is it a good idea to validate againist HTML5 when we built website in HTML4
  3. When we specify html5 why so many errors got reduced?
  4. Upto what extent the page should be validated?
  5. How does html5 page affects the SEO

回答1:


  1. Yes. But: those <header>, <nav> etc elements are not mandatory! A HTML5 document is a valid HTML5 document even if they are "missing".
  2. No.
  3. I beg your pardon?
  4. Can you give an example? If you mean proprietary style properties like -webkit-appearance, yes, you'll have to live with the fact that those don't validate.
  5. I'm not sure they do, actually. They may have an effect in the future though.


来源:https://stackoverflow.com/questions/17587711/how-html5-page-structure-affects-w3c-validation-and-seo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!