QA
Beginner LevelHTML & Semantic Web

What are the rules and constraints surrounding the <main> landmark element?

❓ Interview Prompt: Explain <main> element, primary document content, accessibility landmark role, and single active instance constraints.

The '<main>' element represents the dominant content unique to the document body.

Strict Rules:

1
Unique Content Only: Must NOT include repeated header navigation, sidebar widgets, or footer copyright notices.
2
Single Active Instance: An HTML document must contain only ONE visible '<main>' element at a time.
3
Forbidden Ancestors: Must NOT be nested inside '<header>', '<nav>', '<article>', or '<footer>'.

Code Implementation Example

html
<body>
  <header><!-- Navigation --></header>

  <!-- Unique primary content container -->
  <main id="main-content">
    <h1>Dashboard Overview</h1>
  </main>

  <footer><!-- Footer --></footer>
</body>
💡Correct placement of single active <main> element in document layout.
🎯 Interview Key Takeaway

Include only one visible <main> landmark per document, containing content unique to that page.

#main tag#Landmarks#Accessibility#Beginner
Back to all HTML & Semantic Web Questions→

More HTML & Semantic Web Interview Questions

Beginner LevelHTML & Semantic Web

What is Semantic HTML and why is it essential for modern web applications?

Beginner LevelHTML & Semantic Web

What is <!DOCTYPE html> and what happens if it is omitted?

Beginner LevelHTML & Semantic Web

What is the difference between inline and block-level HTML elements?