Skip to main content

Command Palette

Search for a command to run...

HTML <main> Tag

Updated
•1 min read•View as Markdown
HTML <main> Tag
M
Hi, I'm Subhash Singh, a Computer Science student passionate about web development, programming, and technology. I share simple and beginner-friendly content to help others learn and grow.

Introduction

The <main> tag is a semantic HTML element that represents the primary content of a webpage. It contains the most important information that is unique to that page.

Using the <main> tag helps improve SEO, accessibility, and the overall structure of your website.


What is the <main> Tag?

The <main> tag defines the main content of a webpage.

Example

<main>
  <h2>Welcome to My Website</h2>
  <p>This is the main content of the page.</p>
</main>

Why Use the <main> Tag?

The <main> tag helps:

  • Improve webpage structure
  • Enhance SEO
  • Increase accessibility
  • Make code easier to understand

Complete Example

<header>
  <h1>Journey With Subhash</h1>
</header>

<nav>
  <a href="#">Home</a>
  <a href="#">Blogs</a>
</nav>

<main>

  <h2>Latest Articles</h2>

  <p>
    Learn HTML step by step with simple examples.
  </p>

</main>

<footer>
  <p>© 2026 Journey With Subhash</p>
</footer>

Best Practices

  • Use only one <main> tag on a webpage.
  • Place the primary content inside it