Back to HTML

article, section or div: Choosing Correctly

Coding Tutorials Team 22 June 2026

These three elements cause more hesitation than any others in HTML, partly because the specification language is abstract and partly because they look identical on screen. Two straightforward tests resolve most cases.

The article test

An article is content that would make sense on its own, removed from the page entirely. If you could syndicate it, put it in a feed, or republish it elsewhere without it becoming meaningless, it is an article.

Blog posts and news stories are the obvious examples. Less obviously, so are individual comments, forum posts, product cards in a listing, and widgets such as a weather panel. The element is not restricted to editorial writing despite its name.

<article> <h2>How specificity is calculated</h2> <p>...</p> </article>

Articles can nest. A blog post is an article, and each comment on it is an article inside that one, which correctly expresses that a comment is self contained while also belonging to the post.

The section test

A section is a thematic grouping of content, and the reliable test is whether it has a heading. The specification says a section should generally have one, and in practice a section you cannot write a heading for is not a section.

Sections divide a document into named parts: chapters, the numbered parts of a long article, the distinct areas of a home page.

<section> <h2>Pricing</h2> <p>...</p> </section>

If you find yourself wanting a section for something with no natural heading, that is a signal you want a div.

The difference between them

The distinction is self containment. An article stands alone. A section is part of something larger and depends on its context to make sense.

A recipe is an article, because it works republished anywhere. The ingredients list within it is a section, because it means nothing without the recipe around it.

Where both seem to apply, ask whether the content would be complete in a feed reader with nothing around it. If yes, article. If it would be a fragment, section.

When to use a div

A div is correct whenever you need a container and the grouping carries no meaning. A wrapper constraining page width, a flex container arranging three cards, a target for a border or a background.

Using a div here is not a compromise or a failure. It is the right element, and the specification is explicit that a div should be used when no other element is appropriate. Replacing every div with a section produces markup that claims structure the content does not have, which is worse than a neutral container.

The outline algorithm is gone

Older material claims that sectioning elements create their own heading hierarchy, so a level one heading inside a section is automatically demoted. This was specified and never implemented by any browser or screen reader, and has since been removed from the standard.

Choose heading levels according to their position in the whole document. A section inside a page whose main heading is level one takes a level two heading, regardless of how deeply nested the section is.

Sections and landmarks

A section becomes a region landmark only when it has an accessible name, which usually means an aria-labelledby attribute pointing at its heading. Without a name it is not exposed as a landmark at all.

This is worth knowing because it means unnamed sections add nothing to landmark navigation. Naming a small number of important regions is more useful than wrapping everything in sections and expecting them to be navigable.

Article metadata

An article commonly needs a byline, a publication date and a set of tags. The convention places the title and date in a header inside the article, and the tags and author details in a footer inside it.

Dates should use the time element with a machine readable attribute, since a search engine building a result from your page needs an unambiguous value and a date written for humans alone is open to misreading.

A worked example

A blog listing page has a main element containing a level one heading and a series of articles, one per post. Each article has a heading, a summary and a link. The sidebar beside them is an aside. The filter controls above them are a div, because they are a group with no thematic meaning of their own.

Inside a single post, the post itself is an article, its major parts are sections with headings, and the wrapper holding the author photograph next to the byline is a div. Every choice follows from the two tests, and nothing needs a judgement call about what looks tidiest.