The HTML <main> element identifies the dominant, unique content of a webpage or application. It helps browsers, search engines, developers, and assistive technologies understand which part of the page contains the central topic or primary function.
<body>
<header>
<h1>My Website</h1>
</header>
<nav>
<a href="/">Home</a>
<a href="/articles">Articles</a>
</nav>
<main>
<h2>Latest Technology News</h2>
<p>
This section contains the primary content of the page.
</p>
</main>
<footer>
<p>Copyright 2026</p>
</footer>
</body>The opening tag is <main>, and the closing tag is </main>.
The <main> element should contain content that is directly related to the page’s central subject or purpose, such as:
For example, on a technology article page, the article title, introduction, body text, images, examples, and related explanations would normally belong inside <main>.
Avoid placing repeated site-wide content inside <main>, including:
These elements generally belong in <header>, <nav>, <aside>, or <footer> instead.
Use one visible <main> element
A document should not contain more than one <main> element unless the additional elements have the hidden attribute. In ordinary webpages, use one visible <main> element.
<main>
<h1>Page title</h1>
<p>Main page content.</p>
</main>Do not nest it inside certain elements
<main> should not be placed inside:
<header><footer><nav><aside><article>It is normally used as a major region directly within <body>.
Correct
<body>
<header>Website header</header>
<main>
<article>
<h1>Understanding Cloud Computing</h1>
<p>Article content...</p>
</article>
</main>
<footer>Website footer</footer>
</body>Incorrect
<article>
<main>
<h1>Article title</h1>
</main>
</article>An <article> can be placed inside <main>, but <main> should not normally be placed inside an <article>.
The <main> element creates a main landmark. Screen readers can use landmarks to help users jump quickly to the page’s primary content. This is especially helpful when a page has a large navigation menu, advertising area, or repeated header content.
You can also add an id to create a “Skip to main content” link:
<body>
<a href="#main-content">Skip to main content</a>
<header>
<h1>Example Website</h1>
</header>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
<main id="main-content">
<h2>Welcome</h2>
<p>This is the primary content of the page.</p>
</main>
</body>When a user activates the link, focus moves to the main content area, allowing them to bypass repeated navigation.
The <main> element does not have special attributes of its own. However, it supports standard global attributes, including:
<main id="content" class="page-content">
...
</main>Common global attributes include:
idclassstylehiddendata-*langThe id attribute is particularly useful for skip links.
<main> versus <div>A <div> is a generic container with no inherent meaning:
<div class="main-content">
...
</div>The <main> element communicates a specific meaning:
<main>
...
</main>Using <main> makes the document structure clearer and improves accessibility. It is usually preferable to using a <div> for the central content area.
The <body> contains all visible webpage content, including the header, navigation, main content, sidebar, and footer.
The <main> element contains only the central content:
<body>
<header>Header</header>
<nav>Navigation</nav>
<main>
Main page content
</main>
<aside>Sidebar</aside>
<footer>Footer</footer>
</body>In short:
<body>: Everything displayed on the page.<main>: The page’s primary and unique content.The <main> element can help search engines and other software understand the page’s structure, but it is not a direct ranking factor by itself. Good SEO still depends on factors such as useful content, clear headings, internal linking, accessibility, performance, and appropriate metadata.
A well-structured article might look like this:
<main>
<article>
<h1>What Is the HTML Main Tag?</h1>
<p>
The HTML main element identifies the primary content of a webpage.
</p>
<h2>Why Is the Main Tag Important?</h2>
<p>
It improves semantic structure and helps assistive technologies locate
the most important content.
</p>
</article>
</main><main> represents the primary content of a webpage.<main> element per page.<header>, <footer>, <nav>, <aside>, or <article>.<body>.<div> for the main content area.