Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 2.4 — Quotes, Code, Time and Other Meaningful Text
HTML · Example 2 of 2

pre keeps whitespace, code shows tags safely

The newline right after <pre> was dropped. The escaped tags became text, not elements.

HTML has small elements that say exactly what a piece of text is: a quotation (blockquote, q, cite), an abbreviation (abbr), contact details (address), a date (time), or computer text (code, pre, kbd, samp, var).

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 6 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Mark up this sentence: "In the book Clean Code, the author writes: functions should do one thing." (a short in-line quote and a book title).

02

Write a line that shows an event at 6:30 pm on 1 May 2026 in India (UTC+05:30), shown to humans as "May Day evening".

03

Show the instruction "Press Ctrl+Shift+I to open DevTools" and a code block showing <h1>Hi</h1>.

Explain it without notes

01

What's the difference between the cite attribute and the cite element?

02

Why does time have a datetime attribute when the date is already written in the text?

03

Explain how to show a block of HTML code on a web page so it displays as text.

04

When would you use kbd versus samp versus code?

pre keeps whitespace, code shows tags safely

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

"Preformatted   text\n    keeps   every space\n"
<p>Hello & welcome</p>
Elements inside the code: 0