Lessons in this course (11)

1. Document structure and semantic HTML

Basic★ Must knowLesson 1 of 11
html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Orders — Divakar Shop</title>
  <link rel="stylesheet" href="styles.css">
  <script src="app.js" defer></script>
</head>
<body>
  <header><nav aria-label="Main"><a href="/">Home</a> <a href="/orders">Orders</a></nav></header>
  <main>
    <article>
      <h1>Order #1001</h1>
      <section><h2>Items</h2> …</section>
    </article>
    <aside>Related offers</aside>
  </main>
  <footer>© 2026</footer>
</body>
</html>

Why semantic tags matter: screen readers use them as landmarks, search engines understand the content, and code is easier to read. <div> and <span> have no meaning — use them only for styling hooks.

ElementMeaning
header / footerIntro / closing content of a page or section
navMajor navigation links
mainThe unique main content (one per page)
articleSelf-contained content (post, product card)
sectionThematic group with a heading
asideRelated but secondary content
h1–h6Heading hierarchy — don't skip levels for styling

Block vs inline: block elements (div, p, h1, section) start on a new line and take full width; inline elements (span, a, strong) flow within text and ignore width/height; inline-block flows inline but accepts width/height.