【发布时间】:2011-04-17 09:43:22
【问题描述】:
我有点困惑我应该如何使用 HTML5 <header>、<section> 和 <footer> 标签。目前,我无法确定是否像这样使用它们:
<section id="example_section">
<header>
<h1>Example Section</h1>
<p>etc</p>
</header>
<p>Content para 1</p>
<p>Content para 2</p>
<p>Content para 3</p>
<footer>
Wasn't that swell?
</footer>
</section>
或者像这样:
<header>
<h1>Example Section</h1>
<p>etc</p>
</header>
<section id="example_section">
<p>Content para 1</p>
<p>Content para 2</p>
<p>Content para 3</p>
</section>
<footer>
Wasn't that swell?
</footer>
或者妥协,像这样:
<section id="example_section_wrapper">
<header>
<h1>Example Section</h1>
<p>etc</p>
</header>
<section id="example_section">
<p>Content para 1</p>
<p>Content para 2</p>
<p>Content para 3</p>
</section>
<footer>
Wasn't that swell?
</footer>
</section>
我已包含 ID 以显示这些部分的预期含义。我意识到它们是不必要的。哪种方法是正确的?
【问题讨论】:
标签: html semantics semantic-markup