HTML and CSS Reference
In-Depth Information
1.6 Choosing Between <article> and <section>
Problem
You don't know whether
article
or
section
is the most appropriate element to use on
your web page.
Solution
Focus on your content and the semantic definitions of
article
and
section
(refer back
to
Recipe 1.5
).
<article>
article
can be considered a specialized form of
section
. It is intended for content that
could stand on its own, outside of all surrounding content, such as “syndicatable”
content like blog posts.
article
is suitable for other types of content, including:
• Video and accompanying transcript
• News articles
• Blog comments
Often the name of an article or a blog post is in the title of the URI. If
that's the case with a page you are working on, that content should be
wrapped in an
article
element.
In the code example in
Recipe 1.5
, we used
article
to contain the individual blog posts:
<article>
<h2><code>nav</code> Isn't for <em>All</em> Links</h2>
<p>Though the <code>nav</code> element often contains links, that doesn't mean
that <em>all</em> links on a site need <code>nav</code>.</p>
</article>
<article>
<h2>You've Got the <code>DOCTYPE</code>. Now What?</h2>
<p>HTML5 isn't an all or nothing proposition. You can pick and choose what
works best for you. So once you have the <code>DOCTYPE</code> in place, you
should explore.</p>
</article>