问题
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>
- If we specify doctype as html5 do we need to make website html5 specific / do we have to maintain html5 structure ?
- Is it a good idea to validate againist HTML5 when we built website in HTML4
- When we specify html5 why so many errors got reduced?
- Upto what extent the page should be validated?
- How does html5 page affects the SEO
回答1:
- Yes. But: those
<header>
,<nav>
etc elements are not mandatory! A HTML5 document is a valid HTML5 document even if they are "missing". - No.
- I beg your pardon?
- 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. - 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