DiscoveryVIP / HTML & CSS AcademyHelp

11. Meaningful text formatting

Module 3 · About 20 minutes · Lesson 10; review earlier concepts as needed

Open Interactive Lesson

Discover

What changes when you use meaningful text formatting, and how can you prove it?

Predict

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

Understand

Text semantics express importance, emphasis, quotations or code rather than simply a visual effect. strong and em can be announced differently by assistive technologies depending on settings; do not assume presentation alone conveys meaning. code identifies program text and a surrounding pre preserves whitespace. Use CSS to alter appearance without changing the underlying purpose of the words.

Important source lines

index.html:1 <p><strong>Important:</strong> save your source.</p>
A paragraph of prose. Attribute guidance: global attributes.
index.html:2 <p>Use <code>padding</code> for internal space.</p>
A paragraph of prose. Attribute guidance: global attributes.
index.html:3 <blockquote><p>Start small, then verify.</p></blockquote>
An extended quotation with its own block context. Attribute guidance: cite optional source URL; visible attribution is separate.

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: Meaningful text formatting

The property name is identified as code, while important instructions and a quotation have separate meanings.

index.html

<p><strong>Important:</strong> save your source.</p>
<p>Use <code>padding</code> for internal space.</p>
<blockquote><p>Start small, then verify.</p></blockquote>

styles.css

script.js

Expected: The property name is identified as code, while important instructions and a quotation have separate meanings.

Edit and Render This Example
Example 2: Element: strong

Strong importance rather than merely bold appearance.

index.html

<p><strong>Important:</strong> keep a recovery copy before replacing files.</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: Strong importance rather than merely bold appearance. Review its real DOM and native behavior; structural/media-only examples are labeled.

Edit and Render This Example
Example 3: Element: code

A fragment of computer code.

index.html

<p>Use <code>gap: 1rem</code> to separate layout items.</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: A fragment of computer code. Review its real DOM and native behavior; structural/media-only examples are labeled.

Edit and Render This Example
Example 4: Element: blockquote

An extended quotation with its own block context.

index.html

<blockquote cite="https://example.com/source"><p>Make the structure understandable before decorating it.</p></blockquote>

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: An extended quotation with its own block context. 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

The property name is identified as code, while important instructions and a quotation have separate meanings. Repair the current exercise without removing necessary content. Checks inspect the stated structural/computed/stylesheet contract, not exact source text.

Starter index.html

<p><strong>Important:</strong> save your source.</p>
<p>Use padding for internal space.</p>
<blockquote><p>Start small, then verify.</p></blockquote>

Starter styles.css

Objective contract

[
  {
    "type": "count",
    "selector": "code",
    "value": 1,
    "label": "Include 1 matching code 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 <code>padding</code>. The exercise instead uses padding. Identify its effect before changing it.

Hint 3

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

Complete reference solution

index.html

<p><strong>Important:</strong> save your source.</p>
<p>Use <code>padding</code> for internal space.</p>
<blockquote><p>Start small, then verify.</p></blockquote>

styles.css

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. The property name is identified as code, while important instructions and a quotation have separate meanings.

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 12: Creating hyperlinks

Detailed learning and editor help · Standards reference