HTML <main> Tag

The <main> tag is new in HTML5.

<main> tag represents the main content of a document. It needs to be unique and it must not have a contain which is repeated in documents such as sidebars, navigation links, copyright information, site logos, and search forms.

Beside being unique, you should not use <main> element more than one in a document. It must not be a descendent of an <article>, <aside>, <footer>, <header>, or <nav> element.

An HTML document can have a maximum of one <main> element.

The <main> tag comes in pairs. The content must be written between opening (<main> ) and closing (</main> ) tags.

Meanwhile, let us remind you that <main> element is not supported by Internet Explorer.

Let's see an example:

<!DOCTYPE html>
         <p>Football is a team sport which is so famous across the world.</p>
            <h2>English Football</h2>
            <p>English Premier League is the most liked football league in the world.</p>
            <p>... </p>
            <p>... </p>
            <h2>American Football</h2>
            <p>Football is different in America. If you say football, they will understand their special football. Normal football is called as soccer in the USA.</p>
            <p>... </p>

Here the result is:


<main> tag uses the Global Attributes.