Yes, you may use section
there.
When you use headings, you have "implicit" sections anyway. By using section
, you can make them explicit, which is encouraged (see last quote).
These snippets are semantically equivalent (they have the same outline):
<!-- using headings + div elements -->
<aside class="example-1">
<h1>Heading for this aside</h1>
<div>
<h2>Latest news</h2>
<p>…</p>
</div>
<div>
<h2>Choose site theme</h2>
<p>…</p>
</div>
</aside>
<!-- using headings only -->
<aside class="example-2">
<h1>Heading for this aside</h1>
<h2>Latest news</h2>
<p>…</p>
<h2>Choose site theme</h2>
<p>…</p>
</aside>
<!-- using section elements -->
<aside class="example-3">
<h1>Heading for this aside</h1>
<section>
<h2>Latest news</h2>
<p>…</p>
</section>
<section>
<h2>Choose site theme</h2>
<p>…</p>
</section>
</aside>
Note: if you don’t provide a heading for the aside
, the document outline will be different when section
is used. Which is not a bad thing; I guess that outline is what you typically want anyway. You can play around with gsnedders’ online outliner.
Of course you can also have other sectioning elements instead of section
inside of the aside
(e.g. nav
for the navigation of that aside
, or article
for a list of related posts, etc.).
Side note: In your case, you might consider using several aside
elements instead. This can’t be answered in general, it depends on the content, but a rule of thumb could be: Use one aside
with several sections
/headings inside, if all these sections are related somehow (i.e. if you could find a heading that describes all these sections). Use several aside
, if not.
So your example could look like:
<aside class="widget">
<h2>Latest news</h2>
<ul>…</ul>
<a>more news</a>
</aside>
<aside class="widget">
<h2>Choose site theme</h2>
<input type="select" />
</aside>
<aside class="widget">
<h2>Newsletter subscription</h2>
<form>…</form>
</aside>
<aside class="widget">
<h2>Related articles</h2>
<ul>…</ul>
</aside>
(And use a container div
for these, if you need one.)