HTML <main> Tag
Description
The <main>
HTML tag is a structural element introduced in HTML5 to represent the main content of a document. It is used to enclose the primary content of a web page, excluding any content that is repeated across multiple pages such as headers, footers, and navigation menus. By using the <main>
tag, web developers provide a clear indication to search engines and assistive technologies about the main topic or purpose of the webpage, improving the overall accessibility and search engine optimization of the site. Including the main content within this tag enhances the document's semantic structure, making it easier for both machines and humans to understand the hierarchy and organization of the page's content.
Properties
- Permitted Parents
- Where flow content is expected, but only if it is a hierarchically correct main element.
- Content
- Flow content
- Start/End Tags
- Start tag: required, End tag: required
Example
<body>
<a href="#main-content">Skip to main content</a>
<!-- navigation and header content -->
<main id="main-content">
<!-- main page content -->
</main>
</body>
Attributes
None
Global Attributes
The <main>
tag also supports the Global Attributes in HTML5
Event Attributes
The <main>
tag also supports the Event Attributes in HTML5
Browser Support
The following table will show you the current browser support for the HTML <main>
tag.
Desktop | |||||
12 | 26 | 21 | 16 | 7 |
Tablets / Mobile | |||||
26 | 21 | 14 | 7 | 1.5 | 4.4 |
Last updated by CSSPortal on: 30th September 2023