๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

Full-Stack Web Development Bootcamp Module 1 ยท Lesson 1 of 15

0% Exit to course

Module 1 ยท The browser: HTML and CSS Lesson 1 of 15

Semantic HTML

Learning objective

Tags describe meaning, not appearance: header, nav, main, article, footer. Screen readers, search engines and the next developer all depend on that meaning being real.

The concept

Semantic HTML means using the tag that says what the content IS: header, nav, main, section, article, footer, button. A wall of divs looks identical on screen and tells every machine that reads the page โ€” a screen reader, a search crawler, your own future self โ€” nothing at all.

Structure a page as one h1, then h2 for each section, with the content under each heading. Buttons that do something are <button>; links that go somewhere are <a href>. Use div only when there is no better tag, and then only as a wrapper.

HTML
<header>
  <h1>Asha Patil</h1>
  <nav><a href="#projects">Projects</a> ยท <a href="#contact">Contact</a></nav>
</header>
<main>
  <section>
    <h2>Projects</h2>
    <article>
      <h3>Expense tracker</h3>
      <p>Records expenses and prints a monthly total per category.</p>
      <button>View the code</button>
    </article>
  </section>
</main>

Common mistakes

The mistake is choosing a tag for how it LOOKS โ€” h3 because the text should be smaller, or a div with a click handler where a button belongs. Styling is CSS's job. Tag by meaning, style by class, and keyboard and screen-reader users get working software for free.

Worked example

A job card is an <article> with an <h3> title, not five <div>s โ€” the first is readable by a screen reader, the second is a wall of nothing.

Your practice task

Take any page you use daily and rewrite the skeleton of it in semantic tags only, without any styling.

Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.

Key takeaway

Semantic HTML means using the tag that says what the content IS: header, nav, main, section, article, footer, button.

Create free account or sign in

Almost there

15 lessons left of 15

Finish every lesson to unlock the certificate. Each one ends in a practice task โ€” do them and the final project brief writes itself.

Next recommended course Data Analytics with SQL & Excel