MGU Computer Science Series — Web Development: HTML, CSS, and JavaScript
Part II: HTML — Structure and Meaning
Headings · Paragraphs · Emphasis · Semantics · Landmarks
Chapter 6 of 30
6
MGU Computer Science Series  ·  Web Development: HTML, CSS, and JavaScript  ·  Library Textbook Edition

Chapter 6:
Text, Headings, Paragraphs,
and Semantic Elements

Structuring written content with meaning — headings, paragraphs, emphasis, and the landmark elements that give a page an accessible, navigable shape

■ Part II of VII ■

■ 10 Sections  •  Chapter 6 of 30 ■

Builds directly on Chapter 5 — the HTML document skeleton

Chapter Introduction and Learning Objectives

Chapter 5 introduced the HTML document skeleton: the <!DOCTYPE>, the <html> element, the <head>, the <body>, and the basic structure that every page shares. You learned how to write a valid starter page and how to nest elements correctly.

This chapter goes inside the <body> and teaches you how to structure written content. Most of what exists on the web is text — headings, paragraphs, articles, descriptions, instructions, labels, and explanations. HTML gives you specific elements for all of these, and the choice of element matters. Not for decoration, but for meaning.

By the end of this chapter you will understand why <h1> is not just a way to make text bigger, why <p> is not just a way to add space, and why elements like <main>, <section>, <article>, <header>, <footer>, and <aside> exist alongside simple headings and paragraphs. You will understand semantic HTML — writing code that says what things are, not just what they look like.

Opening Question

Two developers build pages that look identical in a browser. One wraps every piece of content in <div> elements styled with CSS classes. The other uses <h1>, <p>, <h2>, and <p> elements that CSS then styles to match. Side by side on screen, the two pages are indistinguishable. So does it matter which approach a developer chooses? By the end of this chapter, you will understand why the answer is an emphatic yes — and why the choice between meaningless containers and meaningful elements shapes who can use a page, how easily it can be found, and how easily it can be maintained.

10Sections
9Objectives
16Key Terms
30Total Chapters

Learning Objectives

By the end of this chapter, you should be able to:

  1. 1Explain why HTML structure should reflect the meaning of content rather than its desired visual appearance.
  2. 2Use the heading elements <h1>–<h6> to build a correct heading hierarchy without skipping levels.
  3. 3Use the paragraph element <p> correctly, including appropriate use of line breaks and proper nesting.
  4. 4Distinguish stress emphasis (<em>) and strong importance (<strong>) from purely visual styling elements such as <i> and <b>.
  5. 5Define semantic HTML and explain its benefits for assistive technology, search engines, and code maintainability.
  6. 6Use <main>, <section>, and <article> to structure the major content of a page.
  7. 7Use <header>, <footer>, and <aside> to mark introductory, concluding, and tangentially related content.
  8. 8Explain how landmark elements, including <nav>, help users of assistive technology navigate a page.
  9. 9Build a complete, semantically correct article page that combines headings, paragraphs, emphasis, and landmark elements.

Sections at a Glance

Sections 6.1 – 6.3
The Basic Units of Written Content
Text on the Web · Headings · Paragraphs

Text Content on the Web

Open almost any web page and look at what it contains. A news article has a title, a publication date, several paragraphs of body text, and maybe a pull quote. A documentation page has a large heading, several sub-headings, code blocks, and explanatory paragraphs. A product page has a product name, a price, a description, a list of features, and customer reviews.

All of this is text content. And all of it carries structure — not just visual structure, but logical structure. A product name is more important than a feature description. A section heading divides one topic from another. A paragraph groups a single idea together.

HTML was designed to encode this logical structure. When you write an HTML document, you are not designing a visual layout. You are describing what each piece of content is. Visual layout is CSS's job. Structure and meaning is HTML's job.

Who Depends on Structure
Assistive Technology
Screen readers read HTML structure to understand the page. A heading lets a user list every section and jump directly to one. A paragraph is announced as a block of continuous text. Visual appearance is irrelevant — only what you label in HTML is communicated.
Who Depends on Structure
Search Engines
A search engine trying to understand your page pays attention to your headings, paragraphs, and semantic landmarks. Pages with clear, logical structure are easier to index and easier to rank correctly.
Who Depends on Structure
Future Developers
When you return to a project months later, or someone else works on it, clean structural HTML tells the story of the page without requiring anyone to read every pixel of the rendered output.
The Goal of This Chapter

The goal is not to make text look a certain way. The goal is to mark text accurately so that browsers, assistive technologies, search engines, and future developers all understand what the page contains. Appearance comes later, in Part III, once the meaning is already correct.

Headings and Heading Order

HTML provides six heading elements:

<h1>Heading Level 1</h1>
<h2>Heading Level 2</h2>
<h3>Heading Level 3</h3>
<h4>Heading Level 4</h4>
<h5>Heading Level 5</h5>
<h6>Heading Level 6</h6>

These six elements represent a hierarchy, not a set of font sizes. <h1> is the highest-level heading on the page — the main title or primary subject. <h2> introduces major sections under that title. <h3> introduces sub-sections inside an <h2> section. And so on through <h6>, which is rarely used.

Most pages you build in this course will use <h1> through <h3> regularly, and <h4> occasionally. You will rarely have reason to use <h5> or <h6> in a typical page.

The Heading Hierarchy Rule

The most important rule about headings is: do not skip levels. A page that jumps from <h1> to <h3> has broken its outline. A page with two different <h1> elements in the same main content area may confuse assistive technologies about what the primary subject is.

Think of headings like an outline you might write before an essay:

I. Introduction to Astronomy         <- h1
   A. The Solar System               <- h2
      1. The Sun                     <- h3
      2. The Planets                 <- h3
   B. Stars and Galaxies             <- h2
      1. Types of Stars              <- h3
II. Observation Techniques           <- h1 (or h2, depending on page context)

Each level of that outline maps to a heading level in HTML.

One <h1> Per Page

As a strong general guideline for this course, use exactly one <h1> per page. It should represent the single most important heading on that page — the title of the article, the name of the product, the main subject the page covers. If your site's name lives in a <header> as a logo, the <h1> should still identify the content of that particular page, not just the site name.

What Headings Are Not

Headings are not ways to make text big or bold. Many beginners reach for <h2> because it makes text a certain size in the browser's default stylesheet. This is a mistake. Size is a CSS concern. If you want text to be large, set its font-size in CSS. Choose your heading level based on the document's structure, not its visual appearance.

Common Mistake

The second heading below is being used as a visual caption, not a major section heading. This misrepresents the page structure and causes problems for screen readers. HTML provides <figcaption> for captions, covered in Chapter 8.

Wrong — Using h2 Just to Make Text Bigger
<h2>Welcome to my page</h2>
<p>Some content here.</p>
<h2>This is a caption</h2>
<img src="photo.jpg" alt="A mountain landscape">

Default Heading Appearance

A Good Habit to Build Now

Browsers apply default styles to headings — <h1> is typically the largest, <h6> the smallest. These are browser defaults, not permanent rules. Once you add your own CSS in Part III, you can make any heading look however you want, and its appearance will no longer match its level unless you design it that way deliberately. Choose your HTML based on meaning, then use CSS to control appearance.

Paragraphs

The paragraph element <p> wraps a unit of related text that belongs together as a single thought or idea:

<p>The web was invented by Tim Berners-Lee in 1989 as a way to share research
documents among scientists at CERN. It was built on top of the existing
internet infrastructure and used a new system of linked documents.</p>

<p>Within a few years, the web had expanded far beyond scientific research.
Commercial websites, news organizations, and individuals began publishing
content, and browsers became some of the most widely used software on
any platform.</p>

Each <p> element is a separate block. Browsers insert spacing between paragraphs by default, which you will later control with CSS.

What Goes Inside a Paragraph

A <p> element should contain prose — sentences that read together as connected text. You should not put block-level elements like headings, lists, or other paragraphs inside a <p>. Nesting a block inside a <p> creates invalid HTML that browsers may silently correct in unpredictable ways.

Invalid — Block Element Inside a Paragraph
<p>Here is some information.
  <h3>A Subheading</h3>
  And some more information.
</p>

The <h3> should live outside the paragraph, not inside it.

Paragraphs Versus Line Breaks

A common beginner question is: "What is the difference between ending a paragraph and inserting a line break?"

HTML provides <br> — a self-closing element — for a single line break within flowing content. A line break is not a new paragraph; it is a hard line break within the same paragraph.

<p>123 Main Street<br>
Springfield, IL 62701</p>

This is a typical use of <br>: an address that needs lines to break without starting a new paragraph. Addresses are a single unit of information, so they belong in one <p>, but they are traditionally formatted on separate lines.

Avoid This Habit

Using multiple <br> elements to create visual spacing between sections of text is poor practice. Use paragraphs, margins, and CSS spacing instead.

Paragraphs Are Not the Only Text Container

Not all text belongs in a <p>. A list item goes in <li>. A table cell goes in <td>. A navigation link sits in an <a> inside a list. A heading uses one of the <h1> through <h6> elements. As this chapter continues, you will see many other ways to contain and organize text content.

Sections 6.4 – 6.6
Emphasis and the Meaning of Markup
Stress · Importance · Semantic HTML

Emphasis and Strong Importance

HTML provides two inline elements for emphasizing text within a paragraph or heading:

<em>emphasized text</em>
<strong>strongly important text</strong>

<em> — Stress Emphasis

The <em> element marks text that has stress emphasis — the kind of vocal stress you would apply when reading aloud. Compare these two sentences:

Stress Emphasis Changes Meaning
The same words, two different emphases
  • Version A"I said you should call her, not him." — written as I said you should call <em>her</em>, not him.
  • Version B"I said you should call her, not him." — written as I said <em>you</em> should call her, not him.
  • Why it mattersBrowsers typically render <em> in italics by default, but the semantic meaning is stress emphasis, not italics. Screen readers may change their vocal tone when reading <em> content.

<strong> — Strong Importance

The <strong> element marks text that is strongly important — content that carries weight, severity, or urgency:

<p>Before proceeding, <strong>back up your data</strong>. This operation
cannot be undone.</p>

Browsers render <strong> in bold by default. Again, the semantic meaning is importance, not visual boldness. Use CSS to control visual weight.

What <em> and <strong> Are Not

Do not use these elements for purely visual effect. If you want italic or bold text for stylistic reasons — naming a book title or highlighting a term — HTML provides other elements, or you can apply CSS directly.

ElementSemantic MeaningDefault StyleTypical Use
<em>Stress emphasisItalicChanging meaning through vocal stress
<strong>Strong importanceBoldWarnings, key points, urgent instructions
<i>Alternate voice, mood, or offset contextItalicBook and film titles, technical terms on first use, foreign phrases
<b>Drawing attention without implying importanceBoldKeywords in a summary, product names in a review
<p>The novel <i>Moby-Dick</i> was published in 1851.</p>
<p>Search for <b>organic cotton</b> to filter the results.</p>
Practical Guidance

In practice for this course, you will use <em> and <strong> most often, because they carry semantic weight. Use <i> for titles and technical terms. Avoid using <b> and <i> purely for visual styling — that is CSS's job.

Line Breaks and Horizontal Rules

You have already seen <br> for line breaks. Two additional minor elements are worth covering briefly.

<br> — Line Break

As covered above, <br> creates a single hard line break within a paragraph or other inline content. It is self-closing and does not take a closing tag:

<p>To apply, send your materials to:<br>
Admissions Office<br>
Room 204, Building A</p>

Use <br> only when the line break is meaningful — addresses, poetry, song lyrics, and similar content where line breaks carry semantic or conventional significance. Do not use <br> to add visual spacing between sections. Use CSS margins and padding for spacing.

<hr> — Thematic Break

The horizontal rule element <hr> represents a thematic break between sections of content within a document — a shift in scene in a story, a section break in a long article, or a major topic transition:

<p>This section covers the history of the web.</p>

<hr>

<p>This section covers modern web development tools.</p>

Browsers render <hr> as a horizontal line by default. You can style it with CSS. <hr> is a void element, meaning it has no content and no closing tag.

Semantic Meaning, Not Decoration

<hr> marks a thematic break, not just a visual line. If you want a decorative divider with no semantic meaning, use a CSS border or background instead of <hr>.

Semantic HTML

You have now encountered <h1> through <h6>, <p>, <em>, <strong>, and a few other elements. All of them share an important quality: they communicate what something is, not just how it should look.

This is the core principle of semantic HTML. The word "semantic" means "relating to meaning." Semantic HTML is HTML that uses elements chosen to match the meaning of the content, not the desired visual appearance.

Compare these two approaches to the same recipe content:

Non-Semantic — "Div Soup"
<div class="big-text">Recipe: Classic Tomato Soup</div>
<div class="body-text">This recipe serves four people and takes about
thirty minutes to prepare.</div>
<div class="big-text">Ingredients</div>
<div class="body-text">You will need tomatoes, olive oil, onion, garlic,
broth, salt, and pepper.</div>
Semantic — Meaningful Structure
<h1>Recipe: Classic Tomato Soup</h1>
<p>This recipe serves four people and takes about thirty minutes
to prepare.</p>
<h2>Ingredients</h2>
<p>You will need tomatoes, olive oil, onion, garlic, broth, salt,
and pepper.</p>

Both might look similar in a browser if the CSS is designed that way. But only the second version tells a machine — a screen reader, a search engine, a browser's reading mode, or a developer — what the content actually is.

The <div> element is a generic block container with no semantic meaning. It groups content visually but says nothing about what that content represents. The <span> element is the inline equivalent — also generic, also meaningless on its own.

<div> and <span> are useful tools, and you will use them in this course, especially when you need a container for CSS layout purposes. But they should not replace semantic elements when semantic elements exist and apply. The principle is: use the most specific semantic element that correctly describes your content.

Why Semantic HTML Matters

Benefit 1
Assistive Technology Users
Screen readers build navigation menus from headings. Voice control software lets users say "click the heading" or "navigate to main content." Keyboard users rely on landmark regions.
Benefit 2
Search Engines
A page that correctly marks its title as <h1>, its sections as <h2>, its navigation as <nav>, and its main content as <main> is far easier to index and rank.
Benefit 3
Developers Maintaining the Code
Semantic HTML is self-documenting. Reading <article> tells you something. Reading <div class="article-thing-box"> tells you less.
Benefit 4
Browsers and Reading Modes
Browsers have reader modes that strip visual styling and show only content. These modes rely on semantic elements to identify what to show.
Benefit 5
Future Compatibility
HTML standards evolve. Pages written with correct semantics tend to remain valid and functional longer than pages that abuse generic containers.
A Standard, Not a Style Preference

Semantic HTML is not optional for professional web development. It is the foundation of accessible, maintainable, and well-indexed websites.

Sections 6.7 – 6.10
Landmark Elements and Page Structure
Main · Section · Article · Header · Footer · Aside · Nav

<main>, <section>, and <article>

Chapter 5 introduced the three-part skeleton: <html>, <head>, and <body>. Everything visible to the user lives inside <body>. But <body> can contain many different kinds of content — primary content, navigation, sidebars, headers, and footers. HTML5 introduced several landmark elements to describe the roles of these regions.

<main> — The Main Content

The <main> element wraps the primary, unique content of the page. There should be exactly one <main> element per page, and it should not contain content that repeats across pages, like navigation menus, site headers, or site footers.

<body>
  <header>
    <!-- Site header: logo, navigation -->
  </header>

  <main>
    <!-- This page's unique content: the article, the product, the form, etc. -->
    <h1>Understanding the Water Cycle</h1>
    <p>The water cycle describes the continuous movement of water on,
    above, and below Earth's surface.</p>
  </main>

  <footer>
    <!-- Site footer: copyright, links -->
  </footer>
</body>
Skip to Main Content

Screen readers allow users to jump directly to <main> to skip repeated navigation — a feature often called "skip to main content." When you use <main> correctly, this works automatically.

<section> — A Thematic Grouping

The <section> element represents a standalone thematic section of a document or page — a group of related content that has a heading. It is not a general-purpose container. If you are reaching for <section> but cannot give the section a heading, you may want <div> instead.

<main>
  <h1>Our Services</h1>

  <section>
    <h2>Web Design</h2>
    <p>We create responsive, accessible websites for businesses of all sizes.</p>
  </section>

  <section>
    <h2>Graphic Design</h2>
    <p>Our design team produces logos, branding, and print materials.</p>
  </section>
</main>

Each <section> groups a distinct theme — one for web design, one for graphic design — and each has its own <h2>.

<article> — Self-Contained Content

The <article> element represents a piece of content that is self-contained and independently distributable. If you could take the content out of the page, publish it somewhere else, and it would still make complete sense on its own, it is likely an <article>. News articles, blog posts, product listings, forum posts, and user reviews are good candidates:

<main>
  <h1>Latest News</h1>

  <article>
    <h2>New Library Opens in Downtown</h2>
    <p>The Riverside Public Library opened its doors this morning to
    more than three hundred visitors.</p>
  </article>

  <article>
    <h2>Annual Science Fair Announced</h2>
    <p>The regional science fair will take place on March 15th at the
    community center.</p>
  </article>
</main>

Choosing Between <section> and <article>

The distinction is not always obvious. Here is a simple test:

Decision Test
Section, article, or div?
  • ArticleCould this content stand alone, outside of this page, and still make sense? If yes, it is likely an <article>.
  • SectionIs this a thematic grouping within a larger whole, not intended to stand alone, but with its own heading? If yes, it is likely a <section>.
  • DivIs this just a layout container with no semantic purpose and no heading of its own? If yes, use <div>.

These elements can also nest. An <article> can contain multiple <section> elements. A <section> can contain <article> elements. The structure should reflect the content, not your desired layout.

Landmarks and Page Meaning

The elements you learned in Sections 6.7 and 6.8 — <main>, <section>, <article>, <header>, <footer>, and <aside> — are called landmark elements. They identify the major regions of a page. There is one more landmark element that belongs in this list: <nav>.

<nav> — Navigation

The <nav> element marks a set of navigation links — links that help the user move around the site or page. A page can have multiple <nav> elements: one for the primary site navigation, one for a table of contents, one for footer links.

<header>
  <nav aria-label="Main navigation">
    <ul>
      <li><a href="/">Home</a></li>
      <li><a href="/about">About</a></li>
      <li><a href="/resources">Resources</a></li>
    </ul>
  </nav>
</header>

The aria-label attribute on <nav> gives the navigation a human-readable name, which helps screen reader users distinguish between multiple navigation regions on the same page. You will learn more about aria-* attributes in Chapter 29.

How Landmarks Help Users

When a page uses landmark elements correctly, users of assistive technologies can do something remarkable: they can jump directly to any major region of the page. Screen readers provide keyboard shortcuts and menus that let users say, "Go to main content," "Go to navigation," or "Go to footer" — and the screen reader jumps immediately to the correct <main>, <nav>, or <footer> element.

A Real Accessibility Problem

This is why using <div> for everything is a real accessibility problem, not just a style preference. A page full of <div> elements has no landmarks. A user relying on keyboard navigation has no way to skip to the content they need.

A Typical Landmark Structure

Here is what a well-structured page outline looks like using landmark elements:

<body>
  <header>                    ← Page header: logo, site nav
    <nav>                     ← Primary navigation
    </nav>
  </header>

  <main>                      ← Unique page content
    <h1>Page Title</h1>

    <section>                 ← Major section
      <h2>Section One</h2>

      <article>               ← Self-contained piece
        <header>              ← Article header
          <h3>Article Title</h3>
        </header>
        <p>Content...</p>
        <footer>              ← Article footer
          <p>Author info</p>
        </footer>
      </article>

    </section>

    <aside>                   ← Tangential sidebar
      <h2>Related Links</h2>
    </aside>

  </main>

  <footer>                    ← Page footer
    <nav>                     ← Footer navigation
    </nav>
  </footer>
</body>

This structure might seem like a lot of elements for a simple page. For very short pages — a single article, a contact form, a landing page — you will use fewer of these elements. But for any page with multiple regions, meaningful sections, and navigation, this kind of structure is appropriate and expected.

Building a Structured Article Page

This section brings together everything covered in the chapter. You will build a structured, semantically correct article page step by step. The page represents a single article on an educational website. It has a site header with navigation, a main content area with the article, a sidebar with related links, and a footer.

Step 1: Plan the Content

Before writing code, identify what each piece of content actually is:

  • Site name and main navigation → <header> containing the site name and <nav>
  • Article title → <h1> inside <article> inside <main>
  • Article publication info → <header> inside <article>
  • Article sections → <section> inside <article>, each with an <h2>
  • Emphasized terms → <em> or <strong> inside <p>
  • Sidebar with related links → <aside> inside <main>
  • Footer copyright and legal links → <footer>

Step 2: Build the Page Skeleton

Start with the HTML document structure from Chapter 5, then add landmark regions:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>How Photosynthesis Works — Science Today</title>
</head>
<body>

  <header>
    <!-- Site header goes here -->
  </header>

  <main>
    <!-- Main content goes here -->
  </main>

  <footer>
    <!-- Site footer goes here -->
  </footer>

</body>
</html>

Step 3: Build the Site Header

<header>
  <p><strong>Science Today</strong></p>
  <nav aria-label="Main navigation">
    <ul>
      <li><a href="/">Home</a></li>
      <li><a href="/articles">Articles</a></li>
      <li><a href="/topics">Topics</a></li>
      <li><a href="/about">About</a></li>
    </ul>
  </nav>
</header>
Note

The site name uses <strong> inside a <p> here because it is not a heading — it is the site name in the header. Once CSS is applied, it will look like a logo. You could also use a heading element for the site name; conventions vary. What matters is that you make a conscious choice based on meaning.

Step 4: Build the Article

<main>

  <article>

    <header>
      <h1>How Photosynthesis Works</h1>
      <p>By <strong>Dr. Amara Osei</strong> ·
         Published <time datetime="2025-09-01">September 1, 2025</time></p>
    </header>

    <p>Photosynthesis is the process by which plants, algae, and some
    bacteria convert light energy into chemical energy stored as glucose.
    It is <em>one of the most important biological processes on Earth</em>,
    forming the foundation of almost every food chain.</p>

    <section>
      <h2>The Basic Equation</h2>
      <p>The overall chemical equation for photosynthesis is often written as:</p>
      <p>Carbon dioxide + Water + Light energy → Glucose + Oxygen</p>
      <p>This summary captures the inputs and outputs but hides a great deal
      of complexity inside the chloroplast.</p>
    </section>

    <section>
      <h2>Where Photosynthesis Happens</h2>
      <p>In plants, photosynthesis takes place primarily in the leaves,
      inside organelles called <em>chloroplasts</em>. Chloroplasts contain
      a green pigment called <em>chlorophyll</em>, which absorbs light
      energy — particularly in the red and blue wavelengths.</p>
    </section>

    <section>
      <h2>The Two Stages</h2>

      <p>Photosynthesis is divided into two major stages:</p>

      <section>
        <h3>The Light-Dependent Reactions</h3>
        <p>These reactions occur in the thylakoid membranes inside the
        chloroplast. They capture light energy and use it to split water
        molecules, releasing oxygen as a byproduct and producing energy
        carriers used in the next stage.</p>
        <p><strong>Key point:</strong> The oxygen released during
        photosynthesis comes from water, not from carbon dioxide.</p>
      </section>

      <section>
        <h3>The Calvin Cycle</h3>
        <p>Also called the light-independent reactions or the dark reactions,
        the Calvin cycle takes place in the stroma of the chloroplast.
        It uses the energy carriers from the light reactions to convert
        carbon dioxide into glucose.</p>
      </section>

    </section>

    <section>
      <h2>Why Photosynthesis Matters</h2>
      <p>Photosynthesis produces the oxygen in Earth's atmosphere and
      forms the base of almost all food webs. Without it, <strong>most
      life on Earth could not exist</strong>. Understanding photosynthesis
      also has practical applications in agriculture, renewable energy
      research, and climate science.</p>
    </section>

    <footer>
      <p>Filed under: <a href="/topics/biology">Biology</a>,
         <a href="/topics/plants">Plants</a></p>
    </footer>

  </article>

  <aside>
    <h2>Related Articles</h2>
    <ul>
      <li><a href="/articles/cellular-respiration">Cellular Respiration Explained</a></li>
      <li><a href="/articles/plant-cells">Inside a Plant Cell</a></li>
      <li><a href="/articles/food-webs">Food Webs and Energy Flow</a></li>
    </ul>
  </aside>

</main>

Step 5: Build the Footer

<footer>
  <p>© 2025 Science Today. All rights reserved.</p>
  <nav aria-label="Footer navigation">
    <ul>
      <li><a href="/privacy">Privacy Policy</a></li>
      <li><a href="/contact">Contact Us</a></li>
      <li><a href="/accessibility">Accessibility</a></li>
    </ul>
  </nav>
</footer>

Review: What This Page Does Well

Checklist of Good Practice in This Example
  • One <h1> on the page, identifying the article's subject.
  • Logical heading order: <h1> → <h2> → <h3>, no levels skipped.
  • <em> used for stress emphasis on important terms; <strong> used for genuinely important key points.
  • Landmark regions: <header>, <main>, <aside>, <footer>, and <nav>.
  • The article uses its own <header> and <footer>.
  • <section> elements group related content under headings, and nest correctly.
  • No <div> used where a semantic element applies.
  • The sidebar uses <aside> with a proper heading.
  • Navigation elements use aria-label attributes to distinguish between the main and footer navigation.

This page has no CSS attached yet. It will look plain in a browser — black text on a white background, with browser default sizes and spacing. That is expected. In Part III you will attach stylesheets that make it look like a real article page. The HTML structure you have built here will support any visual design you create.

Chapter Summary

Key Terms

semantic HTML
HTML written to describe the meaning of content, not its visual appearance.
heading hierarchy
The ordered use of <h1> through <h6> to represent the outline of a document without skipping levels.
landmark element
An HTML element that identifies a major region of a page, such as <main>, <nav>, <header>, <footer>, <aside>, and <section>.
<main>
The element that wraps the primary, unique content of a page. One per page.
<section>
A thematic grouping of content, typically with its own heading. Not a general-purpose container.
<article>
A self-contained, independently distributable piece of content, such as a news article, blog post, or product listing.
<header>
Introductory content for its parent element. Can appear at the page level or inside <article>, <section>, and other elements.
<footer>
Concluding content for its parent element. Can appear at the page level or inside <article> and other elements.
<aside>
Content that is tangentially related to the surrounding content; a sidebar, pull quote, or supporting note.
<nav>
A set of navigation links.
<em>
Stress emphasis on text; typically rendered in italics by default.
<strong>
Strongly important text; typically rendered in bold by default.
<br>
A hard line break within a paragraph or other inline content. A void element.
<hr>
A thematic break between sections of content. A void element.
<div>
A generic block-level container with no semantic meaning. Used for layout purposes when no semantic element applies.
<span>
A generic inline container with no semantic meaning. Used for styling purposes when no semantic element applies.
PracticeCode Reading

Study each example below and answer the questions that follow.

  1. Example A.
    <h1>Mountain Biking in the Pacific Northwest</h1>
    <p>The Pacific Northwest offers some of the most varied mountain
    biking terrain in North America.</p>
    <h2>Trail Types</h2>
    <p>Riders can choose from flow trails, technical descents,
    cross-country routes, and urban singletracks.</p>
    <h3>Flow Trails</h3>
    <p>Flow trails are designed for smooth, rhythmic riding with
    berms, rollers, and jumps.</p>
    1. Is the heading hierarchy correct in Example A? What is the sequence?
    2. What is the <h1> identifying?
    3. How many sections does this page currently have, based on the headings?
  2. Example B.
    <body>
      <div class="top-area">
        <h2>Welcome to GreenLeaf Gardens</h2>
        <div class="links">
          <a href="/">Home</a>
          <a href="/plants">Plants</a>
          <a href="/contact">Contact</a>
        </div>
      </div>
      <div class="content">
        <h1>Spring Planting Guide</h1>
        <p>This guide will help you prepare your garden for the spring
        planting season.</p>
      </div>
    </body>
    1. Identify two problems with the heading hierarchy in Example B.
    2. Which elements should replace the <div> elements in this code? Write corrected versions.
    3. What landmark element is missing for the navigation links?
  3. Example C.
    <p>Always wear your helmet. <strong>Never ride without one.</strong></p>
    <p>For uphill sections, shift to a <em>lower gear</em> before the
    climb begins, not during.</p>
    1. Is <strong> used correctly in the first paragraph? Explain why.
    2. Is <em> used correctly in the second paragraph? Explain why.
    3. If you wanted to make the word "lower" visually italic for stylistic reasons only, with no stress meaning, which element would be more appropriate: <em> or <i>?
PracticeCode Tracing

Walk through the code as a screen reader would. List the landmarks and headings in the order they appear, then describe what a user navigating by headings alone would encounter.

<body>
  <header>
    <nav>
      <a href="/">Home</a>
      <a href="/blog">Blog</a>
    </nav>
  </header>
  <main>
    <article>
      <header>
        <h1>Ten Ways to Improve Your Sleep</h1>
        <p>By Dr. Patel · June 3, 2025</p>
      </header>
      <section>
        <h2>Your Sleep Environment</h2>
        <p>Keep your bedroom cool, dark, and quiet.</p>
        <section>
          <h3>Managing Light</h3>
          <p>Use blackout curtains or a sleep mask.</p>
        </section>
      </section>
      <section>
        <h2>Your Sleep Schedule</h2>
        <p>Go to bed and wake up at the same time every day.</p>
      </section>
    </article>
    <aside>
      <h2>Related Topics</h2>
    </aside>
  </main>
  <footer>
    <p>© 2025 Wellness Journal</p>
  </footer>
</body>
PracticePredict the Result
  1. What will a browser display for the following code using default browser styles? Describe the visual output. There is also a structural problem with this code — what is it?
    <h1>Bicycle Safety Guide</h1>
    <h3>Helmet Selection</h3>
    <p>Choose a helmet that fits snugly and is certified for your riding style.</p>
  2. Predict what this code produces. Is the semantic choice appropriate for each element?
    <p>The experiment requires <strong>safety goggles</strong> at all times.
    Students who forget their goggles will <em>not</em> be permitted
    to participate.</p>
PracticeDebugging and Error Analysis

Find and correct the errors in each example below. Some examples may have more than one error.

  1. <h1>Community Garden Newsletter</h1>
    <h1>What's Happening This Season</h1>
    <p>This season we have planted tomatoes, squash, and basil.</p>
    <h1>Volunteer Opportunities</h1>
  2. <p>Introduction to the topic.
      <h2>First Section</h2>
      Details about the first section.
    </p>
  3. <body>
      <div>
        <nav>
          <a href="/">Home</a>
        </nav>
      </div>
      <div>
        <h2>Welcome to Our Site</h2>
        <p>We build accessible websites.</p>
      </div>
      <div>
        <p>© 2025 Example Co.</p>
      </div>
    </body>
  4. <article>
      <h1>Product Review: Backpack Pro 5000</h1>
      <p>This backpack is perfect for long hiking trips.</p>
    </article>
    
    <article>
      <h1>Product Review: Trail Boots X2</h1>
      <p>These boots offer excellent ankle support.</p>
    </article>

    Hint: consider what page structure surrounds these articles and what the one-<h1>-per-page convention means in this context. What heading level would be appropriate for the article titles here?

PracticeShort Build Tasks
  1. Biography page. Write HTML for a short biography page that includes: a page <header> with the site name and a <nav> with at least two links; a <main> region containing one <h1> with the person's name, at least two <section> elements each with an <h2> and at least one <p>, and at least one use each of <em> and <strong>; and a <footer> with a copyright line. Do not add CSS — focus entirely on correct semantic structure.
  2. Rewrite for semantics. Rewrite the following badly structured code using correct semantic HTML:
    <div class="page-header">
      <div class="site-title">Blue Heron Bakery</div>
      <div class="nav">
        <a href="/">Menu</a>
        <a href="/order">Order</a>
        <a href="/about">About</a>
      </div>
    </div>
    <div class="main-stuff">
      <div class="big-heading">Fresh Bread, Made Daily</div>
      <div class="text">We bake all of our bread on site every morning using local grains.</div>
      <div class="medium-heading">Our Specialties</div>
      <div class="text">Our most popular items include sourdough, rye, and challah.</div>
    </div>
    <div class="bottom">
      <div class="copyright">© 2025 Blue Heron Bakery</div>
    </div>
  3. Write an aside. Write an <aside> element that would be appropriate to include inside an article about climate change. The aside should contain a relevant key fact with its own heading. Write the aside in valid semantic HTML.
ReviewAccessibility Check

Review the structured article page from Section 6.10. For each item below, find the line of code that addresses it, or note if it is missing. For any item that is missing or could be improved, describe what you would add.

  1. A heading that identifies the page's main subject.
  2. A landmark region that marks the primary content.
  3. A navigation region with an accessible label.
  4. At least one use of <em> for stress emphasis.
  5. At least one use of <strong> for importance.
  6. An <aside> for supplementary content.
  7. A <footer> that closes the article with metadata.
  8. Correct heading order, with no levels skipped.
Mixed ReviewCumulative Questions, Chapters 1–6
  1. What is the difference between the internet and the web? (Chapter 2)
  2. What does the <title> element in the <head> do? Where does it appear for users? (Chapter 5)
  3. Write a complete valid HTML document skeleton — from <!DOCTYPE html> through </html> — that includes a <title>, a charset meta tag, a viewport meta tag, and an empty <body>. (Chapter 5)
  4. What is the purpose of <!DOCTYPE html> at the top of an HTML file? (Chapter 5)
  5. You have an HTML file called index.html and a CSS file called main.css stored in a folder called css. Write the correct relative path to use when linking the stylesheet in your <head>. (Chapter 3)
  6. Why is it a problem to use <h2> just because it makes text look bigger? (Chapter 6)
  7. What is the difference between <section> and <article>? Give one example use case for each. (Chapter 6)
  8. What does semantic HTML mean, and why does it matter for users of screen readers? (Chapter 6)
Chapter 6 Checklist
Use this to confirm your understanding before moving to Chapter 7
Concepts
  • I can explain why HTML describes meaning rather than visual appearance.
  • I can use <h1> through <h6> to build a heading hierarchy without skipping levels.
  • I can explain why a page should have exactly one <h1>.
  • I can use <p> correctly and avoid nesting block elements inside it.
  • I can distinguish <br> from a new paragraph, and <hr> from a decorative line.
  • I can distinguish <em> and <strong> from <i> and <b>.
  • I can define semantic HTML and explain why it matters.
Applications
  • I can use <main>, <section>, and <article> appropriately and explain the difference between them.
  • I can use <header>, <footer>, and <aside> at the page and article level.
  • I can use <nav> with an aria-label to mark navigation regions.
  • I can build a full article page combining headings, paragraphs, emphasis, and landmark elements.
Study Habits
  • I checked my own heading order for skipped levels before considering a page finished.
  • I asked, for each piece of content, "what is this?" before choosing an element.
  • I avoided reaching for <div> until I confirmed no semantic element applied.
Preview — Chapter 7
Links, Navigation, and Site Structure

Chapter 7 teaches you how to connect pages and sites together using links. The anchor element <a> is one of the most fundamental elements in HTML — it is the mechanism that makes the web a web. You will learn how to write relative links between your own pages, absolute links to other sites, internal links that jump to sections of the same page, and how to build a navigation menu that works across an entire multi-page site. You will also begin thinking about information architecture: how the structure of your links shapes the experience of using your site.

MGU Library Connection
  • Web Development: HTML, CSS, and JavaScript — Appendix B: HTML Reference
  • Web Development: HTML, CSS, and JavaScript — Appendix C: Semantic HTML and Accessibility Reference
  • Web Development: HTML, CSS, and JavaScript — Appendix M: Glossary
  • Companion resource: Semantic HTML Guide
  • Companion resource: Heading Order Checklist
  • Next section: Chapter 7 — Links, Navigation, and Site Structure