main element

If you don't know what an element is or how you must use it, I recommend you read the "HTML tags and attributes" tutorial that you can find in the HTML tutorials section.


The 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.

The 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.

The main element can only have as ancestor the elements html, body, div and form.


This example shows a typical document structure where the main element wraps the essential contents.

    <title>Article: Free software</title>
      <p>Welcome to CrazyArticles!</p>
        <a href="/">Home</a>
        <a href="/articles.html">Articles</a>
        <a href="/contactus.php">Contact us</a>
      <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>&copy; All rights reserved</p>


Global attributes

For information about global attributes refer to this list of global attributes in HTML5.


Global events

For information about global events refer to this list of global events in HTML5.