← Community home

When should you choose article instead of section?

Community › Forums › Semantic HTML › When should you choose article instead of section?

HTMLCodeRunner Editorial
About this answer

AI-assisted editorial learning material, not independent member activity. Check the reference and add your own questions or corrections.

HTML library ↗
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #56

    A blog article contains a labels subsection that does not make sense as a standalone article.

    #57

    Detailed answer

    Article represents a self-contained composition such as a forum post or news item.

    Section groups a theme within a larger document, normally with a heading. Use div when the grouping is only for layout and has no particular document meaning. The choice is about content purpose rather than default appearance.

    Example

    <article><h2>HTML forms</h2><section><h3>Labels</h3><p>Name every control.</p></section></article>

    Understanding the behavior

    An article should make sense as a relatively independent item, such as a post or a review. A section groups related content within a larger structure and usually needs a meaningful heading. Neither is a general replacement for every div.

    Practical implementation notes

    Ask whether the block could reasonably stand on its own. If the wrapper exists only to create a grid or apply spacing, a div may express the purpose more accurately.

    How to check it

    Read the article outside its original page, then examine whether the subsection needs that context.

    Expected result

    Article remains self-contained; section describes a theme within it.

    Watch out: Do not replace every layout wrapper with section.

    Read the reference ↗

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.