Right HTML 5 Article Structure
I hope the question is not too generic, but I would need an advice:
Which one of the following examples would you consider to be the right one?
Number 1
<article>
<section>
<header>
<h1>Title</h1>
</header>
<p>Content</p>
<h2>Title 2</h2>
<p>Content</p>
<footer>
<p>footer</p>
开发者_开发百科 </footer>
</section>
</article>
Number 2
<article>
<section>
<header>
<h1>Title</h1>
</header>
<p>Content</p>
<header>
<h2>Title 2</h2>
</header>
<p>Content</p>
<footer>
<p>footer</p>
</footer>
</section>
</article>
Number 3
<article>
<section>
<header>
<h1>Title</h1>
</header>
<p>Content</p>
<footer>
<p>footer</p>
</footer>
</section>
<section>
<header>
<h2>Title</h2>
</header>
<p>Content</p>
<footer>
<p>footer</p>
</footer>
</section>
</article>
I would prefer example number 1, but I am not totally sure :/
1 and 2 are equivalent. Use whichever you prefer. The implicit section started by the <h2>
is inside the explicit section.
3 is semantically different. The <h2>
in the second section has the same ranking as <h1>
in the first section, and the two sections are peers.
精彩评论