Build Your Website from Scratch (3): Semantic HTML and Page Structure

Build a complete page skeleton with header, nav, main, section, article, aside, and footer; get heading order right; and see the effect on SEO and screen readers, with copy-ready valid code.

Build Your Website from Scratch (3): Semantic HTML and Page Structure
Build a complete page skeleton with header, nav, main, section, article, aside, and footer; get heading order right; and see the effect on SEO and screen readers, with copy-ready valid code.

Build Your Website from Scratch (3): Semantic HTML and Page Structure

Share:
⏱ 6 min read🔄 Updated: 2026-12-02✍ NOOR 4 TECH team

What is semantic HTML and why does it matter? It means using tags that describe the meaning of each part of the page instead of generic div tags.
Key fact: elements like header, nav, main and footer help search engines and screen readers understand your page.
Rebuild your page with the full semantic skeleton in this part and check it with the W3C validator.

In part 2 we wrote a first page and passed the browser and validator checks. Today we go further: build a complete page skeleton with semantic HTML, and see why the right element matters more than how the code looks. By the end you have a full shop page structure, valid with zero errors, and understandable to Google and to a screen reader.

1. The problem: a page made of divs

Most beginners write everything like this:

<div class="header">...</div>
<div class="menu">...</div>
<div class="content">...</div>
<div class="footer">...</div>

It renders fine, but it tells nobody what each part does: not Google, not a screen reader, and not you a month later. Semantic elements fix that.

2. What “semantic HTML” means

Semantic means the tag name describes the meaning of the content, not its appearance. <nav> means “this is a navigation region”, <article> means “this is standalone content”. Appearance belongs to CSS; meaning belongs to HTML.

3. The core elements

  • <header>: page or section header: logo, main title, top utilities.
  • <nav>: a set of primary navigation links, not every link on the page.
  • <main>: the primary content of the page, exactly one per page.
  • <section>: a thematic section with a heading, such as “latest products”.
  • <article>: standalone content that makes sense on its own, such as a news item, product, or post.
  • <aside>: complementary side content such as an offer, ad, or related links.
  • <footer>: page footer: copyright, contact details.

Practical rule: <div> is not the enemy. It is correct when you need a styling container with no semantic meaning.

4. Building the full skeleton

Here is a small shop home page structure, ready to copy:

<!doctype html>
<html lang="en" dir="ltr">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Noor Store — Home</title>
</head>
<body>
  <header>
    <h1>Noor Store</h1>
    <nav>
      <ul>
        <li><a href="#products">Products</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </nav>
  </header>

  <main>
    <section id="products">
      <h2>Latest products</h2>
      <article>
        <h3>Desk calculator</h3>
        <p>A simple calculator with large keys for daily desk work.</p>
      </article>
      <article>
        <h3>Arabic keyboard</h3>
        <p>A keyboard with clear Arabic lettering, resistant to spills.</p>
      </article>
    </section>

    <section id="about">
      <h2>About the store</h2>
      <p>Noor Store has sold office supplies since 2020.</p>
    </section>

    <aside>
      <h2>Offer of the week</h2>
      <p>15% off all calculators until the end of the month.</p>
    </aside>
  </main>

  <footer id="contact">
    <p>© 2026 Noor Store. All rights reserved.</p>
    <p>Contact: <a href="mailto:info@example.com">info@example.com</a></p>
  </footer>
</body>
</html>

5. The result in the browser

The shop page after adding a semantic structure: header, navigation list, products section with two articles, aside, and footer
Figure 1: The shop page after adding a semantic structure: header, navigation list, products section with two articles, aside, and footer

Everything appears in a logical order with no CSS at all: header first, then the main content, the side offer, and the footer last. That is a real gain: a correct structure works before any styling exists.

6. And on mobile

The same page at a 390 pixel mobile viewport: elements stack vertically and stay readable
Figure 2: The same page at a 390 pixel mobile viewport: elements stack vertically and stay readable

Be clear with yourself: semantic elements are not design. This page still has no colours and no layout. CSS comes next in the series and turns this skeleton into a real design. The rule: HTML builds meaning, CSS builds appearance, JavaScript builds interaction.

7. Headings: h1 through h6

  1. Exactly one <h1> per page, describing the whole page.
  2. Do not skip levels: <h2> is followed by <h3>, never by <h4> directly.
  3. A heading describes the content beneath it; it is not a vague teaser.

To check the outline of any page, run this in the console:

document.querySelectorAll("h1,h2,h3,h4,h5,h6").forEach(function(h){
  console.log(h.tagName + " - " + h.textContent.trim());
});

8. Why this matters to Google

  • Search engines use semantic elements to separate primary content from repeated navigation and footers.
  • <article> marks standalone content, which matters for posts, news, and products.
  • Ordered headings show how parts relate, and can help a page win rich results and sitelinks.
  • Content inside <nav> and <footer> repeats on every page, so treating it as primary content is misleading.

9. Why it matters for accessibility

A screen reader user navigates by landmarks: one key jumps to navigation, another to the main content, another to the footer, instead of listening to the whole page. If the page is all <div>, that user is lost.

The cheapest improvement you can add on day one is a skip link, as the first element on the page:

<a href="#main" class="skip-link">Skip to content</a>
...
<main id="main"> ... </main>

Later, CSS hides it until the visitor uses the keyboard. A small detail that matters a lot.

Tip: after each change to the structure, open the page and check that the content order still makes sense with no styling at all.

10. Validate your code

The code above was checked with the official W3C validator: zero errors, zero warnings. Repeat the steps on your own page:

  1. Open the W3C validator.
  2. Choose Validate by File Upload and upload the file, or Validate by Direct Input and paste the code.
  3. If an error appears, read the line number and message and fix it. The most common early error is an unclosed tag.
Warning: do not choose a tag by how it looks in the browser. Choose it by the meaning of the content and leave the look to CSS.

11. Common mistakes

  1. A div for everything: meaning is lost and maintenance gets harder.
  2. More than one h1, or an h3 before any h2.
  3. A section with no heading: a headingless section is just a container, so use a div.
  4. A nav for every link group: nav is for primary navigation, not for every external link in an article.
  5. An article for a short fragment: an article must stand on its own.

12. Summary and what comes next

You now have a complete, semantic page structure, valid with zero errors, and understandable to Google and screen readers. This is the skeleton we will style in the coming parts.

In part 4 we move to forms: <form>, input types, and validating data before it is sent. One mistake in a form makes a site unusable on mobile.

If you would rather have a finished site than build one yourself, you can request a website design service from the Noor4Tech team.

FAQ

Do semantic elements change how the page looks?

No. Without CSS, <header> and <div> look nearly identical. The difference is the meaning delivered to the browser, search engines, and screen readers.

Can a page have more than one header?

Yes. One for the page, and optionally one inside an article or section. The same applies to footer.

Is section always better than div?

No. Section is for a thematic part with a heading. For a styling container with no meaning, use div.

🔗 Official sources

Series: part 3 of Build Your Website from Scratch — previous part: tools and first page · series index · next: forms and inputs.

⭐ Featured Recommendation

📈 Double Your Site Traffic & Revenue with Featured Backlinks & SEO

Get a pinned Featured Backlink in our directory or a complete SEO audit by NOOR 4 TECH experts to dominate rankings.

Explore Featured Package ⭐
💼 NOOR 4 TECH Professional Services

Looking for a Technical Partner for Your Next Project?

We deliver enterprise web development, mobile apps, technical SEO, and AI automation.

Author

Noor4Tech Team

We are a specialized team in providing the best technical and programming content to help you achieve your digital goals.

Comments (0)

No comments yet. Be the first to comment!

Add Your Comment

Your email will not be published. Comments require review before publishing.