Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

HTML element: article

The article element represents a self-contained composition that can be independently distributed or reused.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

<article><h2>…</h2>self-contained composition</article>

article fits a post, report, news item, review, or comment; a layout box or fragment without independent meaning does not become an article.

A nested article should relate to its outer article, such as a comment on a post, rather than serving only as a grouping wrapper.

A clear heading, often h2, helps identify the composition; address can identify its author and time its publication date, but neither replaces substantive content.

The example counts article elements, obtains the direct h2 through :scope, and checks whether the inner h3 belongs to the outer post.

Examples

<!doctype html>
<meta charset="utf-8">
<article id="post">
  <h2>Parser update</h2>
  <p>Details of the release.</p>
  <article id="comment"><h3>Comment</h3><p>Verified.</p></article>
</article>
<output id="result"></output>
<script>
const post = document.querySelector("#post");
const comment = document.querySelector("#comment");
document.querySelector("#result").textContent = `articles=${document.querySelectorAll("article").length}; outerHeading=${post.querySelector(":scope > h2").textContent}; innerOwner=${comment.parentElement.id}; innerHeading=${comment.querySelector("h3").textContent}`;
</script>

Result

articles=2; outerHeading=Parser update; innerOwner=post; innerHeading=Comment

The result verifies the DOM structure of an independent post and comment; it does not prove that the text is useful for actual syndication.

Sources