CodeZettaInterview Hub

HTML · Semantics · Fresh / Intern · Comparison

When should you use <section> vs <article> vs <div>?

Short Interview Answer

<article> is self-contained content; <section> is a thematic grouping; <div> is a meaningless styling/scripting hook.

Detailed Explanation

Use article for posts, cards, or widgets that make sense alone. Use section when a heading groups related content. Use div when you need a box with no semantic meaning. Overusing section without headings is an anti-pattern.

Did you know this answer?