Syntax
<main>
<!-- primary page content -->
</main>Examples
Basic Page Structure
Using main to wrap the primary content of a page.
<header>...</header>
<nav>...</nav>
<main>
<h1>Product Details</h1>
<p>This is the main content unique to this page.</p>
</main>
<footer>...</footer>Main with Multiple Sections
A main element containing several content sections.
<main>
<section>
<h2>About Us</h2>
<p>...</p>
</section>
<section>
<h2>Our Services</h2>
<p>...</p>
</section>
</main>Skip Link Target
Using main as the target for a "skip to content" accessibility link.
<a href="#main-content">Skip to main content</a>
<nav>...</nav>
<main id="main-content">
<h1>Page Title</h1>
</main>Best practices
- Use exactly one <main> element per page, and never nest it inside <header>, <footer>, <nav>, <article>, or <aside>
- Give <main> an id so it can be used as a target for "skip to content" accessibility links
- Only include content in <main> that is unique to the current page — repeated site-wide elements belong outside it
- Screen reader users can jump straight to <main>, so make sure it truly contains the page's primary content
Browser compatibility
Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.
<main>
Desktop
- Chrome
- Supported
From 26 - Firefox
- Supported
From 21 - Safari
- Supported
From 7 - Edge
- Supported
From 12 - Opera
- Supported
From 16
Mobile
- Safari on iOS
- Supported
From 7 - Chrome for Android
- Supported
From 26 - Firefox for Android
- Supported
From 21 - Samsung Internet
- Supported
From 1.5
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 26
Firefox
- From 21
Safari
- From 7
Edge
- From 12
Opera
- From 16
Safari on iOS
- From 7
Chrome for Android
- From 26
Firefox for Android
- From 21
Samsung Internet
- From 1.5
MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.