Skip to content

Help us create more tutorials! Make a donation using the Donate button or become a member using the button below to hide this banner and track your progress.

main element – HTML

Summary

<main>
  <!-- main content of web page goes here -->
  <h1>Your Business</h1>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.</p>
</main>

Details

The main element wraps around the main content of a web page. The main content of a web page means the content that is unique on the page that isn’t shared with other pages.

Elements that are repeated across multiple web pages, such as navigation menus and footers, should not be included inside the main element.

Generally speaking, you should only have one main element per web page. (To be more specific, a “document must not have more than one main element that does not have the hidden attribute specified,” according to the HTML Standard.)

Demo

Exercises

Recreate the embedded CodePen demo by typing out the HTML code in your index.html file.

References

main on MDN

Lesson tags: Open Lesson
Back to: HTML Course > HTML Body Elements