HTML Text Formatting, Headings & Typography
Master heading hierarchy, semantic text emphasis, quotations, code snippets, lists, and screen reader typography rules.
1. Heading Hierarchy & Document Outline (<h1> to <h6>)
HTML provides 6 levels of headings. Headings are structural signposts used by search engine web scrapers and assistive screen readers to generate a table-of-contents outline of your webpage:
💡 Real-World Analogy: Book Chapters & Subsections
Think of heading hierarchy like the table of contents in a textbook:
• <h1> is the Book Title (Only 1 per page representing the main topic).
• <h2> represents major Chapters.
• <h3> represents Sub-topics under that chapter.
• Never skip heading levels (e.g. going directly from <h1> to <h4>) just to get smaller visual font sizing — always use CSS for font size!
<h1>Fullstack Web Engineering Guide 2026</h1>
<h2>Module 1: HTML5 & Modern Semantic Web</h2>
<h3>Section A: Document Anatomy</h3>
<h3>Section B: Accessibility & ARIA</h3>
<h2>Module 2: CSS3 Architecture</h2>
<h3>Flexbox & CSS Grid Layouts</h3>
2. Semantic Emphasis: <strong> vs <b> and <em> vs <i>
While visual browsers render both bold and italics, their semantic implications for assistive technologies differ radically:
Semantic: <strong> & <em>
Conveys Real Meaning & Pitch
<strong>: High urgency / serious importance (screen readers announce with heavier inflection).<em>: Stressed emphasis changing sentence meaning.
<p>Warning: <strong>Do not</strong> share your OTP.</p>
<p>I <em>love</em> JavaScript.</p>
Stylistic: <b> & <i>
Pure Visual Styling
<b>: Draw attention without added importance (e.g. keywords in a product review).<i>: Alternate voice, technical terms, idioms, ship names, or foreign words.
<p>Species: <i>Homo sapiens</i></p>
<p>The <b>bolded</b> product code.</p>
3. Quotations, Citations & Code Snippets
<blockquote>
<p>The Web does not just connect machines, it connects people.</p>
</blockquote>
<p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy <code>let score = 100;</code></p>
<p>Learn <abbr title="Cascading Style Sheets">CSS3</abbr> & <strong>Web APIs</strong>.</p>
"The Web does not just connect machines, it connects people."
Press Ctrl + C to copy let score = 100;
Learn CSS3 & Web APIs.
4. Lists: Unordered (<ul>), Ordered (<ol>) & Description (<dl>)
| List Type | Tags Used | When to Use |
|---|---|---|
| Unordered List | <ul> & <li> |
Items where sequence order does not matter (bulleted list, navbar links, feature items). |
| Ordered List | <ol> & <li> |
Sequential step-by-step instructions, rankings, or algorithm pipelines. |
| Description List | <dl>, <dt> (term), <dd> (desc) |
Key-value pairs, glossaries, product spec sheets, metadata rosters. |
<dl>
<dt>HTTP</dt>
<dd>Hypertext Transfer Protocol for web communication.</dd>
<dt>DOM</dt>
<dd>Document Object Model tree of parsed elements.</dd>
</dl>
- HTTP
- Hypertext Transfer Protocol for web communication.
- DOM
- Document Object Model tree of parsed elements.
5. HTML Typography Interview Quiz Deck
Test your knowledge with 5 text formatting and typography placement questions:
🎯 Placement Interview Takeaways
- Q: Can multiple `<h1>` elements be present on a single webpage?
Ans: While HTML5 technically permits an<h1>inside nested<article>or<section>elements, modern SEO best practices and WCAG accessibility standards strongly recommend exactly ONE `<h1>` per page representing the master page topic. - Q: What is the difference between `<pre>` and `<code>`?
Ans:<code>is an inline semantic tag indicating code syntax.<pre>is a block container that preserves exact whitespaces, indents, and line breaks. They are combined as<pre><code>...</code></pre>for multi-line code blocks.