Skip to main content

HTML Guide

The “main” element must not appear as a descendant of the “article” element.

A main element cannot be placed inside an article element according to HTML5 content model rules.

The main element is intended to identify the dominant content of the <body> that is directly related to, or expands upon, the central topic of a document. It is meant to be unique, appearing only once per document, and must not be a descendant of elements like article, aside, header, footer, or nav. Conversely, the article element represents a self-contained composition that could independently be reused or distributed, such as a blog post or news story.

To resolve the error, move the main element so that it is a direct child of the body, and place any article elements inside the main or at the same level, not the other way around.

Incorrect:

<article>
  <main>
    <h1>Article Title</h1>
    <p>This is the article content.</p>
  </main>
</article>

Correct:

<main>
  <article>
    <h1>Article Title</h1>
    <p>This is the article content.</p>
  </article>
</main>

Minimal valid HTML document:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Article in Main Example</title>
</head>
<body>
  <main>
    <article>
      <h1>Article Title</h1>
      <p>This is the article content.</p>
    </article>
  </main>
</body>
</html>

Use only one main element per page and ensure it is not nested inside sectioning elements such as article.

Learn more:

Related W3C validator issues