HTML - Main Tag


Description

The HTML <main> tag specifies main or important content in the document. It can be used only once per page and can't be used as a descendent of <article>, <aside>, <footer>, <header>, <nav> element.

Example

<!DOCTYPE html>
<html>

   <body>
      <main>
         <h1>Learning</h1>
         <p>Learn to gain experience and try to share your knowledge with others.</p>
         
         <article>
            <h3>Web Development Tutorials</h3>
            <p>Consist of CSS, HTML, and PHP tutorials for 2nd Semester exams.</p>
         </article>
         
         <article>
            <h3>Academic Tutorials</h3>
            <p>Consist of Computer Fundamental, Computer Network tutorials for
               1st Semester exams.</p>
         </article>
      </main>
   </body>

</html>

This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes No Yes Yes No
html_tags_reference.htm
Advertisements