0

如果我们将页面声明为 HTML5,是否必须遵循 HTML5 页面结构?. 下面是两个示例,显示了理想的 HTML5 页面和不遵循 HTML5 结构的页面。

但是当我使用 w3c 验证器验证这两个页面时,这些页面成功地检查为 HTML5,没有错误。

前任:

<!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>

我的页面:

<!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. 如果我们将 doctype 指定为 html5,我们是否需要使网站特定于 html5/我们是否必须维护 html5 结构?
  2. 当我们用 HTML4 构建网站时,验证反对 HTML5 是否是个好主意
  3. 当我们指定 html5 时,为什么会减少这么多错误?
  4. 页面应该被验证到什么程度?
  5. html5页面如何影响SEO
4

1 回答 1

2
  1. 是的。但是:那些<header>, <nav>etc 元素不是强制性的!HTML5 文档是有效的 HTML5 文档,即使它们“缺失”。
  2. 不。
  3. 请再说一遍?
  4. 能给我举个例子吗?如果您的意思是专有样式属性-webkit-appearance,是的,您将不得不忍受那些无法验证的事实。
  5. 实际上,我不确定他们是否这样做。不过,它们可能会在未来产生影响。
于 2013-07-11T07:51:48.183 回答