Skip to content

main-require

A <main> element is required within the <body> tag of HTML documents. This rule ensures that the document has a clear and accessible structure, which is important for both users and screen readers.

Level: Warning

  1. true: enable rule
  2. false: disable rule

The following patterns are not considered rule violations

Section titled “The following patterns are not considered rule violations”
<html><body><main>Content</main></body></html>
<html><body><header>Header</header><main>Content</main><footer>Footer</footer></body></html>

The following patterns are considered rule violations

Section titled “The following patterns are considered rule violations”
<html><body><p>No main tag</p></body></html>
<html><body><header>Header</header><footer>Footer</footer></body></html>