👀 Live Preview
A simple article block as rendered in the browser:
Article Title
Introduction to your article. This content is wrapped in a semantic <article> element.

By the end of this tutorial, you’ll confidently mark up self-contained content with semantic HTML in real-world projects.
Identify when content belongs in <article> vs other sectioning elements.
Wrap blog posts, news stories, and cards with headings and metadata.
Apply the syndication test to choose the right semantic element.
Use class, id, and lang for styling and identification.
Embed comments and related items inside parent articles.
Landmarks, headings, and structured metadata for discoverability.
<article> Tag?The article element (<article>) defines a standalone piece of content. Ask yourself: “Would this block still make sense if I pulled it out and published it elsewhere?” If yes, use <article>.
Typical uses include blog posts, news articles, magazine features, forum posts, and user-submitted comments nested inside a parent article. The browser exposes it as an article landmark for assistive technology.
Each article should include a meaningful heading (h1–h6) and can contain <header>, <footer>, <time>, and other flow content.
Wrap standalone content between opening and closing <article> tags. Include a meaningful heading for accessibility and SEO:
<!-- Basic article syntax -->
<article>
<h2>Article Title</h2>
<p>Introduction to your article...</p>
<!-- Additional content -->
</article><article> is a block-level flow element—not a void tag.<article />) is not valid in HTML.| Aspect | Details |
|---|---|
| Tag-specific attributes | None — uses global attributes only |
class / id | Target articles with CSS and JavaScript |
| Nesting | Allowed — comments and related items inside parent article |
vs <section> | article = distributable; section = thematic grouping |
| Landmark role | article — exposed to assistive technology |
| Common children | h1–h6, p, header, footer, time |
<article> vs <section>Both are sectioning elements, but they serve different purposes:
| Element | Purpose | Example |
|---|---|---|
<article> | Self-contained, syndicatable content | Blog post, news story, product card |
<section> | Thematic group within a page | Chapter, tab panel, grouped form fields |
| Rule of thumb | If it makes sense in an RSS feed alone, use article | |
| Avoid | Don’t use article for sidebars — use <aside> instead | |
The <article> tag has no tag-specific attributes. Use global HTML attributes for styling and identification:
class / id GlobalTarget featured articles, blog cards, or news categories with CSS and JavaScript selectors.
<article class="featured-article" id="main-article">lang OptionalHints the language of the article when it differs from the page’s primary language.
lang="fr"aria-labelledby A11yLinks the article landmark to its heading when multiple unnamed articles appear on one page.
aria-labelledby="post-title"style / data-* OptionalInline styling or custom data attributes for CMS templates and JavaScript hooks.
data-post-id="42"Five real-world article patterns with copy-ready code, live previews, and hands-on practice.
A simple article block as rendered in the browser:
Introduction to your article. This content is wrapped in a semantic <article> element.
The simplest form: a heading and paragraph inside <article>.
<article>
<h2>Article Title</h2>
<p>Introduction to your article...</p>
</article>Apply class and id to target a featured article with CSS or JavaScript. Include an article-level <footer> for author and date metadata.
<article class="featured-article" id="main-article">
<h2>The Importance of Learning HTML</h2>
<p>HTML is the foundation of every website.</p>
<footer>
<p>Written by: Mari Selvan</p>
<p>Published: June 7, 2026</p>
</footer>
</article>Here are the most frequent ways developers use the <article> tag in real projects.
Wrap each blog post in its own <article> on a listing page. Style each card with CSS for a polished blog feed layout.
<style>
article {
background: #fff;
border: 1px solid #e2e8f0;
border-radius: 10px;
padding: 1.25rem;
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
article h2 { color: #1e40af; font-size: 1.125rem; }
</style>
<main>
<article>
<p class="post-meta">June 5, 2026</p>
<h2>Blog Post Title</h2>
<p>Content of your blog post...</p>
<a href="#">Read more</a>
</article>
</main>On a news homepage, each story is an independent <article>. Use CSS category classes and colored left borders to distinguish breaking, sports, and weather stories.
<style>
article.breaking { border-left-color: #dc2626; }
article.sports { border-left-color: #2563eb; }
article.weather { border-left-color: #d97706; }
</style>
<article class="breaking">
<h2>Breaking News Title</h2>
<p>Details of the breaking news...</p>
</article>Combine <header>, <time datetime>, body content, and an <address> in the article <footer> for a complete semantic structure.
<article>
<header>
<h2>Getting Started with Semantic HTML</h2>
<p>Published <time datetime="2026-06-07">June 7, 2026</time></p>
</header>
<p>Semantic HTML elements help browsers and search engines understand your content.</p>
<footer>
<address>Written by <a href="mailto:author@codetofun.com">Mari Selvan</a></address>
</footer>
</article>An <article> can contain nested <article> elements for content related to the parent—most commonly user comments on a blog post:
<article>
<h2>Blog Post Title</h2>
<p>Main article content...</p>
<section>
<h3>Comments</h3>
<article>
<h4>Comment by Jane</h4>
<p>Great article!</p>
</article>
</section>
</article>The <article> element creates an article landmark for screen readers. Follow these guidelines:
h1–h6) that describes its topicaria-labelledby pointing to the article headingWrap standalone content in <article> with a heading, body, and optional <header>/<footer>.
The element is recognized as an article landmark. Search engines identify distinct content blocks for indexing.
Each article can be syndicated via RSS, shared on social media, or extracted without losing meaning.
Users, search engines, and assistive technology all benefit from clearly defined, self-contained content regions.
The <article> tag is supported in all modern browsers. Internet Explorer 9+ recognizes the element; IE 8 and below treat it as a generic block.
From IE 9 to the latest Chromium builds — the article element is a core HTML5 semantic tag with near-universal support.
Bottom line: Ship semantic article markup with confidence. Use one <article> per standalone content block in every production environment today.
The <article> tag empowers you to structure content meaningfully—enhancing user experience, accessibility, and SEO. Use it for blog posts, news stories, and any block that stands on its own.
Pair it with <header>, <time>, and <footer> for rich metadata, and reserve <section> for thematic groupings that are not independently distributable.
<article> for content that is complete and could stand alone<article><time datetime> for machine-readable publication dates<article> for sidebars, footers, or site navigation<article> with <section> for non-standalone groupings<div> when semantic meaning matters for SEO<article>Bookmark these before you ship — they’ll make every content block clearer and more discoverable.
<article> marks content that makes sense on its own—blog posts, news stories, product cards.
Use article for syndicatable blocks; section for thematic groups within a page.
No tag-specific attributes—use class, id, and lang for customization.
Embed comments and related items inside a parent article when they belong to that content.
PatternCreates an accessible region for screen readers. Every article needs a descriptive heading.
A11ySupported in all modern browsers including IE 9+. No polyfills required.
Compatibility<article> element represents a self-contained piece of content—blog posts, news stories, forum posts, or product cards that could be syndicated or shared independently.<article> is for standalone content (syndication test). <section> groups related content within a page that is not necessarily independent.<article> elements represent content related to the outer article, such as user comments on a blog post.class, id, lang, and style.<article> per post.<header> for the article title and metadata, and <footer> for author info or tags—scoped to the article, not the whole page.Open the Try It editor and practice wrapping posts in article elements.
8 people found this page helpful