Loading...
HTML <main> Tag

HTML <main> Tag

In this tutorial, we will learn about main tag in HTML with the help of examples.


<main> Tag

Main tag <main> is used to specifies the main or important content of a document.

Note : The <main> tag must be used only once in a document.
The <main> tag can't be used as a descendent of <article>, <aside>, <footer>, <header>, <nav> tag.

Syntax

<main>........</main>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Main Tag</title>
  </head>
  <body>
    <main>
      <h2>HTML</h2>
      <p>Hyper Text Markup Language</p>
    </main>
  </body>
</html>

Output

HTML

Hyper Text Markup Language


Global Attribute

Main Tag support all the global attributes of HTML.


Event Attribute

Main Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <main> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <map> Tag.

- Related Topics