Skip to main content
HTML Validation

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

About This HTML Issue

A main element cannot be nested within another main element.

The main element represents the primary content of a document or application, and there must be only one per page, not placed inside another main. The main element must not be used as a descendant of another main element. This is important for accessibility, semantic correctness, and helps screen readers correctly identify the main content region.

Invalid example (nested main):

<main>
  <h1>Welcome</h1>
  <main>
    <p>This nested main element is invalid.</p>
  </main>
</main>

Valid example (single main only):

<main>
  <h1>Welcome</h1>
  <section>
    <p>This section is valid and can be placed inside main.</p>
  </section>
</main>

If you need to divide the main content, use sectioning elements like section, article, or div inside a single main element, but never nest main inside main.

Last reviewed: April 23, 2025

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.