HTML main Tag is just a container which is used for the most important or main content of the website or web page. Always use only one main tag on a page.
Table of Contents
Syntax of HTML main Tag
The Syntax of HTML main Tag is shown below, It has both starting tag and ending tag.
<main>
</main>
Usage of HTML main Tag
HTML main Tag is used as a container for the main and unique content of the website. The main tag cannot contain any type of content which is repeatedly used in html document.
HTML main Tag cannot contain another main tag.
HTML main Tag cannot be used inside other tags like nav tag, aside tag, article tag, header tag or footer tag.
HTML main Tag is a block level element.
Example of HTML main Tag
Simple example of HTML main Tag is given below.
<main>
<h1>Web Languages</h1>
<div>
<h1>HTML</h1>
<p>HTML is a markup language.</p>
</div>
<div>
<h1>CSS</h1>
<p>CSS is a style sheet language.</p>
</div>
<div>
<h1>JavaScript</h1>
<p>JavaScript is a client side programming language.</p>
</div>
</main>
In above example we have used main tag for our main content which is unique and important.
Browser Support for HTML main Tag
HTML main Tag is supported by higher versions of latest browsers like Chrome (26), Firefox (21), Edge (12), Opera (16) and more.
Global Attributes Support in HTML main Tag
The HTML main Tag supports all Global Attributes.
Event Attributes Support in HTML main Tag
The HTML main Tag supports all Event Attributes.
HTML main Tag Video
Watch our video on HTML main Tag.