#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
HTML Fundamentals

HTML5 Semantic

Semantic HTML means choosing elements that describe what content is, not just how it should look. HTML5 added a set of structural elements such as header, nav, main, article, section, aside and footer. They look exactly like a div by default, but they tell browsers, screen readers and search engines what role each part of the page plays.

The main structural elements

  • <header> holds introductory content for the page or for a section, such as a logo, a title or a byline.
  • <nav> wraps a major block of navigation links, like the main menu or a table of contents.
  • <main> contains the central content of the page. Use only one visible main per page.
  • <article> is a self-contained piece that would make sense on its own, such as a blog post, a product card or a comment.
  • <section> groups related content under a common heading, like chapters of a long page.
  • <aside> holds content related to the surroundings but not essential, such as a sidebar or a pull quote.
  • <footer> closes a page or section with copyright, contact details or related links.

A page laid out with semantic tags

<body>
  <header>
    <a href="/">Food Notes</a>
    <nav aria-label="Main">
      <ul>
        <li><a href="/recipes">Recipes</a></li>
        <li><a href="/about">About</a></li>
      </ul>
    </nav>
  </header>

  <main>
    <article>
      <h1>Masala Chai at Home</h1>
      <p>Ready in <time datetime="PT15M">15 minutes</time></p>
      <section>
        <h2>Ingredients</h2>
        <p>Tea leaves, milk, ginger, cardamom.</p>
      </section>
      <figure>
        <img src="chai.jpg" alt="Cup of chai with spices">
        <figcaption>Serve hot.</figcaption>
      </figure>
    </article>
    <aside>Try it with fresh mint.</aside>
  </main>

  <footer><p>Contact: hello@example.com</p></footer>
</body>

Who benefits from semantic markup

Screen reader users can jump directly between landmarks, such as straight to the navigation or the main content, instead of listening to the page from the top. Search engines get clearer signals about which part is the actual content and which is repeated chrome. Other developers can read your code more easily, because <nav> explains itself while <div class="nav-wrap-2"> does not. Browser reader modes also rely on these elements to find the article text.

Smaller semantic elements

Semantics also apply at the text level. <time datetime="..."> gives dates a machine-readable value, <figure> with <figcaption> ties a caption to an image, <mark> highlights relevant text, and <strong> and <em> express importance and emphasis rather than plain bold or italic styling.

Headings complete the picture. Start the main content with a single h1 and nest h2 and h3 in order without skipping levels, so the outline makes sense to anyone navigating by headings.

Section versus div, and other misuses

A frequent mistake is replacing every div with section. A section should have a heading and represent a meaningful part of the outline. If you only need a box for styling or layout, a div is still correct. Similarly, not every group of links needs nav; a few links in a footer can stay as a plain list.

Another misconception is that header must appear only once. It can appear inside each article or section as well, while main should not.

Key ideas

Pick the element that names the content's role, give sections headings, keep a single main, and fall back to div whenever no semantic element fits.

Ready to master real-world web development?

Learn HTML, CSS3, Bootstrap and JavaScript hands-on with mentor-led sessions.

Explore Course