Summary
The HTML <main> element represents the main content of the <body> of a document or application. The main content area consists of content that is directly related to, or expands upon the central topic of a document or the central functionality of an application. This content should be unique to the document, excluding any content that is repeated across a set of documents such as sidebars, navigation links, copyright information, site logos, and search forms (unless, of course, the document's main function is as a search form).
Note: <main> must not be a descendent of an <article>, <aside>, <footer>, <header>, or <nav> element.
There is no restriction as to the number of <main> elements in a document. Indeed, there are many cases where it would make sense to have multiple <main> elements. For example, a page with multiple <article> elements might need to indicate the dominant contents of each such element.
- Content categoriesFlow content, palpable content.
- Permitted content Flow content.
- Tag omission None; both the starting and ending tags are mandatory.
- Permitted parent elements Any element that accepts flow content, but may not be a descendent of an
<article>,<aside>,<footer>,<header>, or<nav>element. - DOM interface
HTMLElement
Attributes
This element only includes the global attributes.
Example
<!-- other content -->
<main>
<h1>Apples</h1>
<p>The apple is the pomaceous fruit of the apple tree.</p>
<article>
<h2>Red Delicious</h2>
<p>These bright red apples are the most common found in many
supermarkets.</p>
<p>... </p>
<p>... </p>
</article>
<article>
<h2>Granny Smith</h2>
<p>These juicy, green apples make a great filling for
apple pies.</p>
<p>... </p>
<p>... </p>
</article>
</main>
<!-- other content -->
Specifications
| Specification | Status | Comment |
|---|---|---|
| WHATWG HTML Living Standard The definition of '<main>' in that specification. |
Living Standard | Removed the restriction about not using <main> as a descendent of an <article>, <aside>, <footer>, <header>, or <nav> element. |
| HTML5.1 The definition of '<main>' in that specification. |
Working Draft | No change from HTML5 |
| HTML5 The definition of '<main>' in that specification. |
Proposed Recommendation | Initial definition. |
Browser compatibility
As a newly-proposed feature of HTML, the <main> element is not yet supported widely. You are strongly urged to add the "main" ARIA role to any <main> element:
<main role="main"> ... </main>
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | Chrome 26 | 21.0 (21.0) | Not supported | Opera 16 | Safari 7 |
| Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | Not supported | 21.0 (21.0) | Not supported | Not supported | Not supported |
See also
- Basic structural elements:
<html>,<head>,<body> - Section-related elements:
<article>,<aside>,<footer>,<header>, or<nav>