HTML5 main Tag

As the name tells, the HTML5 main tag allows you to specify the key content of a document. Whatever you write under the <main> tag should be unique. It shouldn’t include the content which is included and repeated on every page, such as copyright information, logo, sidebars, etc.

Example

<!DOCTYPE html>
<html>
<head>
<title>Understanding HTML5 Main tag</title>
</head>
<body>

<main>
  <h1>World Sports</h1>
  <p>Football and Cricket are the 2 most popular team sports in the world.</p>

  <article>
    <h1>Football</h1>
    <p>Football is quite popular in Brazil, Argentina, Germany and many other countries.</p>
  </article>

  <article>
    <h1>Cricket</h1>
    <p>Invented in England, Cricket now have more than 10 official teams.</p>
  </article>
</main>
</body>
</html>

Here’s the output, we’re printing the content for World Sports here with headings Football and Cricket under the <article> element. All the content is our key content, so we added under the HTML5 <main> element,

HTML5 Main Tag

HTML5 header Tag
HTML5 mark Tag
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment