DiscoveryVIP / HTML & CSS AcademyHelp

20. Organizing structured information

Module 4 · About 20 minutes · Lesson 19; review earlier concepts as needed

Open Interactive Lesson

Discover

What changes when you use organizing structured information, and how can you prove it?

Predict

Record the expected structure or visual change before rendering. Name one thing that should remain unchanged.

Understand

Choose structures according to relationships. A description list pairs terms with definitions; a table relates two dimensions; a list groups peers. Using extra div elements for every pair makes those relationships harder to recover. Native elements usually need less custom accessibility work than invented roles. CSS can present a description list as a neat grid without changing its meaning.

Important source lines

index.html:1 <h1>Course facts</h1><dl><dt>Duration</dt><dd>Two afternoons</dd><dt>Prerequisite</dt><dd>A browser and curiosity</dd></dl>
The highest-level heading for a page topic. Attribute guidance: global attributes.
styles.css:1 dl { display: grid; grid-template-columns: 8rem 1fr; gap:.5rem; } dd { margin:0; }
Selects outer/inner display behavior; Grid establishes a layout context. Accepted grammar: [ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>. Context: block.

The first example teaches this lesson’s primary contract. Additional examples are optional related references or applications, each with its own purpose and source; an example without an authored check requires the stated visual/manual review.

Example 1: Organizing structured information

Each term is paired with a description, while Grid handles the presentation.

index.html

<h1>Course facts</h1><dl><dt>Duration</dt><dd>Two afternoons</dd><dt>Prerequisite</dt><dd>A browser and curiosity</dd></dl>

styles.css

dl { display: grid; grid-template-columns: 8rem 1fr; gap:.5rem; } dd { margin:0; }

script.js

Expected: Each term is paired with a description, while Grid handles the presentation.

Edit and Render This Example
Example 2: Element: dl

A group of terms and descriptions.

index.html

<dl><dt>Viewport</dt><dd>The CSS layout area.</dd><dt>Breakpoint</dt><dd>A condition where layout adapts.</dd></dl>

styles.css

body { font:18px/1.6 system-ui; margin:1.5rem; color:#17324d; } img,video,svg { max-width:100%; height:auto; } th,td { padding:.5rem; border:1px solid #a8b8c8; } :focus-visible { outline:3px solid #a44322; outline-offset:3px; }

script.js

Expected: A group of terms and descriptions. Review its real DOM and native behavior; structural/media-only examples are labeled.

Edit and Render This Example
Example 3: Element: dt

A term in a description list.

index.html

<dl><dt>Padding</dt><dd>Internal box space.</dd></dl>

styles.css

body { font:18px/1.6 system-ui; margin:1.5rem; color:#17324d; } img,video,svg { max-width:100%; height:auto; } th,td { padding:.5rem; border:1px solid #a8b8c8; } :focus-visible { outline:3px solid #a44322; outline-offset:3px; }

script.js

Expected: A term in a description list. Review its real DOM and native behavior; structural/media-only examples are labeled.

Edit and Render This Example
Example 4: Element: dd

A description in a description list.

index.html

<dl><dt>Margin</dt><dd>External separation outside a border.</dd></dl>

styles.css

body { font:18px/1.6 system-ui; margin:1.5rem; color:#17324d; } img,video,svg { max-width:100%; height:auto; } th,td { padding:.5rem; border:1px solid #a8b8c8; } :focus-visible { outline:3px solid #a44322; outline-offset:3px; }

script.js

Expected: A description in a description list. Review its real DOM and native behavior; structural/media-only examples are labeled.

Edit and Render This Example
Example 5: Element: h1

The highest-level heading for a page topic.

index.html

<h1>Workshop handbook</h1><p>A principal heading introduces the page.</p>

styles.css

body { font:18px/1.6 system-ui; margin:1.5rem; color:#17324d; } img,video,svg { max-width:100%; height:auto; } th,td { padding:.5rem; border:1px solid #a8b8c8; } :focus-visible { outline:3px solid #a44322; outline-offset:3px; }

script.js

Expected: The highest-level heading for a page topic. Review its real DOM and native behavior; structural/media-only examples are labeled.

Edit and Render This Example

Build and test

Each term is paired with a description, while Grid handles the presentation. Repair the current exercise without removing necessary content. Checks inspect the stated structural/computed/stylesheet contract, not exact source text.

Starter index.html

<h1>Course facts</h1><dl><dt>Duration</dt><dd>Two afternoons</dd><p>Prerequisite</p><dd>A browser and curiosity</dd></dl>

Starter styles.css

dl { display: grid; grid-template-columns: 8rem 1fr; gap:.5rem; } dd { margin:0; }

Objective contract

[
  {
    "type": "count",
    "selector": "dl dt",
    "value": 2,
    "label": "Include 2 matching dl dt element(s)"
  }
]
Hint 1

Locate the first difference between the intended result and the real preview. Inspect matching elements and computed styles.

Hint 2

The relevant source uses <dt>Prerequisite</dt>. The exercise instead uses <p>Prerequisite</p>. Identify its effect before changing it.

Hint 3

Restore the intended <dt>Prerequisite</dt> operation or implement an equivalent structure/style. Run the actual checks and explain why it works.

Complete reference solution

index.html

<h1>Course facts</h1><dl><dt>Duration</dt><dd>Two afternoons</dd><dt>Prerequisite</dt><dd>A browser and curiosity</dd></dl>

styles.css

dl { display: grid; grid-template-columns: 8rem 1fr; gap:.5rem; } dd { margin:0; }

Explain, reflect and extend

Which part of the actual preview or inspector proves this result? Explain one boundary case and name what automated checks do not verify.

Apply this concept to a different realistic piece of content. Predict its structure or visual behavior, test narrow and wide widths where relevant, then record one invalid case and its repair.

Troubleshooting and professional practice

If nothing changes, confirm that you edited the active file and ran Run Preview, or enabled Auto Preview. Inspect the actual DOM because the browser may repair invalid nesting. For CSS, check selector matches, valid declarations, active queries and computed values. Preserve local asset paths and inspect warnings. Each term is paired with a description, while Grid handles the presentation.

Knowledge check

Explain why the stated result follows from the source. Predict a second input or width and test it independently. Automated contracts and written explanations are reviewed separately.

Optional AI prompts

  1. Explain this lesson’s source line by line using the actual objective above.
  2. Help implement one small extension and define normal, boundary and failure tests.
  3. Review/debug the source against actual preview observations; verify standards and never claim rendering without evidence.

Continue to Lesson 21: Semantic HTML

Detailed learning and editor help · Standards reference