我有點困惑,我該如何使用HTML5 <header>
,<section>
和<footer>
標籤。目前,我不能工作了是否使用它們像這樣: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用於顯示各部分的預期含義。我意識到他們是不必要的。哪種方法是正確的?
從一個說「比其他任何人都更好」的人那裏接受語義學建議是一個好主意嗎? (** + 1 **) – Eric 2010-09-26 13:04:22
@Eric:請參閱http://html5doctor.com/avoiding-common-html5-mistakes/和http://html5doctor.com/downloads/h5d-sectioning-flowchart.png。 – 2012-03-09 14:44:57