HTML | <main> Tag

The HTML <main> Tag is used to given the main information of a document. The content inside the <main> element should be unique for the document. Which includes the sidebars, navigation links, copyright information, site logos, and search forms.

Note: The document must not contained more than one <main> element . The <main> element should not be a child elements of an <article>, <aside>, <footer>, <header>, or <nav> element.

Syntax:



<main>
    //contents of main Element 
</main> 

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
  
    <style>
        .class {
            color: green;
        }
    </style>
</head>
  
<body>
    <h1 class="class"><Main> Tag</h1>
    <main>
        <h1>Programming Languages</h1>
        <p>c programming, C++ 
          Programming, Java Prograaming</p>
  
        <article>
            <h1>C Programming</h1>
            <p>C is a Procedural language</p>
        </article>
  
        <article>
            <h1>C++ Programming</h1>
            <p>C++ programming is a 
              Object oriented Programming.</p>
        </article>
  
        <article>
            <h1>Java Programming</h1>
            <p>Java is a pure Object 
              oriented Programming.</p>
        </article>
    </main>
  
</body>
  
</html>

chevron_right


Output:

Supported Browsers: The browsers supported by <main> Tag are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.