HTML5, <section> inside unordered list

Mr Sooul picture Mr Sooul · Aug 24, 2011 · Viewed 7.7k times · Source

Can I use <section> tag inside unordered list?

I know, that <section> represent a generic section of document. Usually we find heading inside.

So... I have list of products. Usually about 20 per page. Each element have:

  • heading,

  • short description (max 255 chars),

  • thumbnail, some details, button.

So each list item is something like section, "is a thematic grouping of content, typically with a heading".

Of course I don't use, <section> to styling purpose.

I think, <section> also could be here a wrapper for a list, and each element of list <article>.

What is your opinion?

Answer

Paul D. Waite picture Paul D. Waite · Aug 24, 2011

Using a <section> tag inside an <li> tag validates (you can try this using the “Text Field” option on http://html5.validator.nu/), and the spec doesn’t seem to suggest you shouldn’t use it in this way (see http://dev.w3.org/html5/spec-author-view/the-section-element.html#the-section-element), so that seems fine to me.

The <article> tag is meant for “self-contained compositions”. I’ve never been entirely clear what that means outside of several blog posts being listed on a single page, but I think product summaries sound like a decent fit for that too. So your second idea of a <section> containing the entire list, and an <article> for each product, probably sounds best.