HTML Tags

HTML <main> Tag

The <main> tag represents the dominant content of the <body> of a webpage.
It should contain content unique to the page, excluding repeated elements like headers, footers, sidebars, or navigation links.

<main> helps assistive technologies and search engines quickly identify the primary content of the page.

Syntax

<main>
  <!-- Primary page content -->
</main>

Attributes

AttributeDescription
idAssigns a unique identifier.
classSpecifies one or more class names.
styleInline CSS styling.
titleProvides additional information about the element.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Main Tag Example</title>
</head>
<body>
  <header>
    <h1>Website Header</h1>
  </header>

  <main style="padding: 20px; background-color: #f9f9f9;">
    <h2>Welcome to Our Website</h2>
    <p>This is the primary content of the page, containing unique information for visitors.</p>
    <p>Content in &lt;main&gt; should not include repeated site elements like navigation or footer links.</p>
  </main>

  <footer>
    <p>&copy; 2025 My Website</p>
  </footer>
</body>
</html>

Output

Browser Output

You will see a distinct main content area with headings and paragraphs.
Content inside <main> is considered the primary page content and is separate from headers, footers, and sidebars.
Use our TryIt Editor to experiment with <main> styling and structure.

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes❌No

All major browsers support <main> tag.

Notes

  • <main> should only appear once per page.
  • Excludes repeated content like <header>, <footer>, and <aside>.
  • Improves accessibility, allowing screen readers to jump directly to main content.
  • Helps SEO by signaling primary content to search engines.

Conclusion

The <main> tag is essential for defining the main content of a webpage.
It provides semantic meaning, accessibility benefits, and clarity for both users and search engines.

Sign In Form

User your email and password to singn in

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend