【发布时间】:2012-05-08 17:37:02
【问题描述】:
我再次向你寻求帮助,Stack Overflow。这次我很难理解 HTML5 关于我网站主要内容标题的语义。下面是两个例子,我应该使用哪一个?也许我应该走一条完全不同的路?
编辑:我混淆了代码示例!
示例 1
使用此代码,我得到如下大纲:
- 类别:foo
- 博文#1
- 博文#2
这似乎不正确,因为博客文章是在该类别下发布的?
<header id="header">
<h1>My awesome website!</h1>
<!-- Primary navigation and such -->
</header>
<div id="content">
<section id="title">
<h1>Category: foo</h1>
<p>Some content</p>
</section>
<article>
<h1>Blog post #1</h1>
<p>Some content</p>
</article>
<article>
<h1>Blog post #2</h1>
<p>Some content</p>
</article>
</div>
示例 2
使用此代码,我得到如下大纲:
- 类别:foo
- 博文#1
- 博文#2
这对我来说似乎是正确的,但 HTML5 Doctor 表示不应将 <section> 用作主要/主要内容包装器。
另外,如果我要使用这个示例,如果主要内容没有自然标题(例如显示所有帖子的索引页面),我会将<section id="content> 与<div id="content"> 交换吗?
<header id="header">
<h1>My awesome website!</h1>
<!-- Primary navigation and such -->
</header>
<section id="content">
<header id="title">
<h1>Category: foo</h1>
<p>Some content</p>
</header>
<article>
<h1>Blog post #1</h1>
<p>Some content</p>
</article>
<article>
<h1>Blog post #2</h1>
<p>Some content</p>
</article>
</section>
【问题讨论】: