Skip to content
Guest
Learn HTML · Course Syllabus Show lessons
Text, Links & Navigation · 8 min read · Beginner

Text Basics, Block vs. Inline & Entities

Distinguish block and inline elements, use semantic text tags like strong, em, time, code, and kbd, and escape special characters with HTML entities.

What you'll learn

  • Tell the difference between block-level and inline-level elements
  • Use semantic inline tags: <strong>, <em>, <mark>, <time>, <code>, <kbd>, <abbr>
  • Display reserved characters like <, >, and & safely with HTML entities

HTML offers rich inline elements that carry real meaning, far beyond just making text bold or italic.

Block vs. Inline Elements

  • Block elements (<p>, <h1>–<h6>, <div>, <blockquote>, <ul>) start on a new line and stretch to fill the available width.
  • Inline elements (<span>, <a>, <strong>, <em>, <code>, <kbd>) flow naturally inside a line of text and only take up as much width as their content needs.

Semantic Inline Text Elements

ElementMeaningExample
<strong>Strong importance / urgency<strong>Warning:</strong> Save first.
<em>Verbal stress / emphasisI <em>really</em> mean it.
<mark>Highlighted search match or referenceMatch: <mark>HTML</mark>
<time>Machine-readable date or time<time datetime="2026-11-25">Nov 25</time>
<code>Inline code snippetUse <code>display: grid</code>
<kbd>Keyboard shortcutPress <kbd>Ctrl</kbd> + <kbd>K</kbd>
<abbr>Abbreviation with expansion<abbr title="HyperText Markup Language">HTML</abbr>

HTML Entities

Because <, >, and & have special meaning in HTML, use character entities when you want to display them literally:

  • &lt; → <
  • &gt; → >
  • &amp; → &
  • &copy; → ©

Fill-in-the-Blank Exercise

Semantic Inline Markup

Mark up a keyboard shortcut, a machine-readable date, and an escaped HTML tag.

<p>Press <>⌘K</kbd> to search.</p>
<p>Updated < datetime="2026-11-25">Nov 25, 2026</time>.</p>
<p>Use the main&gt; landmark.</p>

Try It Yourself

Rich Semantic Typography
Live Result

Check Your Understanding

Score: 0 / 1

1. How do you safely display the literal text <h1> inside an HTML paragraph?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind