Text
Almost every web page is, at its core, structured text — and HTML provides a specific set of tags for exactly that. The key idea running through this entire chapter: HTML tags describe what a piece of text means semantically, while CSS (covered in the separate CSS courses) controls how it actually looks. Choosing the right tag matters even before any styling is applied.
Headings — h1 Through h6
Six levels of heading, from most important (<h1>) to least (<h6>) — used to create a logical outline of the page's content, similar to chapter and section headings in a book.
Page Title
A Major Section
A Subsection
<h4> instead of <h2> purely because it renders smaller breaks the document's logical outline — screen readers and search engines both rely on heading levels reflecting genuine document structure. If a heading needs to look smaller, use CSS to style an <h2> rather than reaching for a lower heading number for purely visual reasons.
Paragraphs
Browsers automatically add space between separate <p> elements — there's no need to manually insert <br> tags between paragraphs to create that visual gap.
Text Formatting Tags
<strong> and <b> often look identical (bold), and the same goes for <em> and <i> (italic). The real difference is semantic: screen readers may change their tone of voice for <strong>/<em> content, and search engines weigh them differently — <b>/<i> carry no such meaning, purely visual styling with zero semantic weight.
Horizontal Rules and Line Breaks
<hr> represents a thematic break between sections of content — not just a decorative horizontal line, even though that's how it renders by default.
A Realistic Example, Combined
Chapter 2 Quick Reference
- h1-h6 — logical document outline, never skip levels for visual sizing alone
- p — paragraphs, with automatic spacing between them
- strong/em — semantic importance/emphasis; b/i — purely visual, no semantic meaning
- small — fine print/disclaimers; mark — highlighted text
- sub/sup — subscript/superscript
- br — a single line break within text, used sparingly
- hr — a thematic break between sections, not just a decorative line
- Next chapter: lists — ordered, unordered, and definition lists