main element is a container for the central topics of a document or section. This central content may be interpreted as all that's left after you remove ads, headers (
header), footers (
footer), navigational sections (
nav), related links and other such secondary elements.
main element has greater importance for people with disabilities, usually accessing the web with special programs like voice browsers. In such cases, browsers can be instructed to go straight to the
main content of the document or section, skipping all irrelevant information.
While there's no restriction as to the number of
main elements in a document, only one is allowed to be visible (to not have the
hidden attribute present) at a time.
This example shows a typical document structure where the
main element wraps the essential contents.
<html> <head> <title>Article: Free software</title> </head> <body> <header> <p>Welcome to CrazyArticles!</p> <nav> <a href="/">Home</a> <a href="/articles.html">Articles</a> <a href="/contactus.php">Contact us</a> </nav> </header> <main> <h1>Free software</h1> <p>Free software, software libre, or libre software is computer software that gives users the freedom to run the software for any purpose as well as to study, modify, and distribute the original software and the adapted versions.</p> <p>...</p> </main> <footer> <p>© All rights reserved</p> </footer> </body> </html>
For information about global attributes refer to this list of global attributes in HTML5.
For information about global events refer to this list of global events in HTML5.