Rebuild a page with semantic elements

Task

The starter page is a blog post built only from <div> elements with class names like "header" and "sidebar". Replace them with semantic elements so browsers, search engines and screen readers understand the structure. The visible content stays the same — only the markup changes.

Requirements

  • The site header with the logo and the menu is a <header>, and the menu is a <nav> with a list of links
  • The page has exactly one <main> that holds the post
  • The post is an <article>; its title and date are in the article's own <header>, and the date uses <time datetime="YYYY-MM-DD">
  • Each part of the post is a <section> with an <h2> heading
  • The popular posts block is an <aside> with its own heading
  • The copyright and contact line is in a <footer>
  • There is one <h1>, heading levels don't skip, and no <div> is left

Starter code

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Coding notes</title>
</head>
<body>
  <div class="header">
    <div class="logo">Coding notes</div>
    <div class="menu">
      <a href="/">Home</a>
      <a href="/articles">Articles</a>
      <a href="/about">About</a>
    </div>
  </div>
  <div class="content">
    <div class="post">
      <div class="post-title">Why semantic HTML matters</div>
      <div class="post-date">12 March 2026</div>
      <div class="part">
        <div class="part-title">Easier to read</div>
        <p>Tags like header and nav tell you what each block is for at a glance.</p>
      </div>
      <div class="part">
        <div class="part-title">Better accessibility</div>
        <p>Screen readers let people jump straight to the main content or to the navigation.</p>
      </div>
    </div>
  </div>
  <div class="sidebar">
    <div class="sidebar-title">Popular posts</div>
    <a href="/articles/html-lists">HTML lists</a>
    <a href="/articles/html-tables">HTML tables</a>
  </div>
  <div class="footer">
    <p>© 2026 Coding notes · <a href="mailto:hello@example.com">hello@example.com</a></p>
  </div>
</body>
</html>
▶ Open in HTML Editor

Hints

  • A page has only one <main>, and it holds the content unique to this page — not the site header, menu or footer.
  • <header> and <footer> can appear more than once: one for the whole site and one inside the <article> for its title and date.
  • A <section> is a thematic part with its own heading. If a block has no natural heading, it probably isn't a section.
  • <aside> is for related but non-essential content, such as popular posts — not for any column that happens to be on the side.
  • <time datetime="2026-03-12"> gives the date in a machine-readable format while the visible text stays the same.
Show solution
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Coding notes</title>
</head>
<body>
  <header>
    <p>Coding notes</p>
    <nav>
      <ul>
        <li><a href="/">Home</a></li>
        <li><a href="/articles">Articles</a></li>
        <li><a href="/about">About</a></li>
      </ul>
    </nav>
  </header>

  <main>
    <article>
      <header>
        <h1>Why semantic HTML matters</h1>
        <p><time datetime="2026-03-12">12 March 2026</time></p>
      </header>
      <section>
        <h2>Easier to read</h2>
        <p>Tags like header and nav tell you what each block is for at a glance.</p>
      </section>
      <section>
        <h2>Better accessibility</h2>
        <p>Screen readers let people jump straight to the main content or to the navigation.</p>
      </section>
    </article>
  </main>

  <aside>
    <h2>Popular posts</h2>
    <ul>
      <li><a href="/articles/html-lists">HTML lists</a></li>
      <li><a href="/articles/html-tables">HTML tables</a></li>
    </ul>
  </aside>

  <footer>
    <p>© 2026 Coding notes · <a href="mailto:hello@example.com">hello@example.com</a></p>
  </footer>
</body>
</html>

Related tools