HTML/Elements/main

From W3C Wiki
< HTML‎ | Elements
Jump to: navigation, search

<main>

The <main> element represents the main content of the body of a document or application.

Point

  • The <main> element is not sectioning content and has no effect on the document outline.
  • There must be only one <main> element per page.

HTML Attributes

See global attributes.

Example

[try it]

<!DOCTYPE html>
<html>
<head>
 <title>Chapter 2 - My eBook</title>
</head>
<body>
 <header>My eBook
  <nav>
   <ul role="directory">
    <li><a rel="prev" href="1.html">Chapter 1</a></li>
    <li><a>Chapter 2</a></li>
    <li><a rel="next" href="3.html">Chapter 3</a></li>
   </ul>
  </nav>
 </header>

 <main>
  <h1>Chapter 2</h1>
  <p>Once upon a time again...</p>
 </main>

 <footer><small>Copyright 2014 Jane Doe</small></footer>
</body>
</html>

HTML Reference

The <main> element was introduced in HTML5 - 4.5.14 The main element.