1. Block-level Text Elements (<p>, <div>, <blockquote>)
Element
Purpose
Display
Semantic Meaning
<p>
Paragraph of text
Block (margin top/bottom)
Text paragraph
<div>
Generic container
Block (no default margin)
No semantic meaning (use for styling/layout only)
<blockquote>
Extended quotation
Block (indented, margin)
Quoted content from external source
<cite>
Citation/reference title
Inline (italic)
Title of creative work
<q>
Inline quotation
Inline (with quotes)
Short quoted text
<hr>
Thematic break
Block (horizontal rule)
Topic/section separation
Paragraph (<p>) Rules:
Cannot contain block elements
Can contain inline and text only
Auto-closes when encountering block element
Use for text content, not layout
Browser adds default margins
Blockquote Attributes:
Attribute
Purpose
cite
URL of quote source
Use <cite> element for visible citation
Example: Text block elements usage
<!-- Paragraphs --><p>This is a standard paragraph with text content.</p><p>Paragraphs can contain <strong>inline elements</strong> and <a href="#">links</a>.</p><!-- Blockquote with citation --><blockquote cite="https://example.com/source"> <p>The only way to do great work is to love what you do.</p> <footer>— <cite>Steve Jobs</cite></footer></blockquote><!-- Inline quote --><p>As Einstein said, <q>Imagination is more important than knowledge.</q></p><!-- Thematic break --><section>First topic content</section><hr><section>New topic content</section><!-- Generic container (styling only) --><div class="content-wrapper"> <p>Wrapped content</p></div>
2. List Elements (<ul>, <ol>, <li>, <dl>, <dt>, <dd>)
Element
Type
Purpose
Child Elements
<ul>
Unordered List
Bulleted list (order doesn't matter)
Only <li>
<ol>
Ordered List
Numbered list (sequential order)
Only <li>
<li>
List Item
Individual list item
Any flow content
<dl>
Description List
Term-description pairs
Only <dt> and <dd>
<dt>
Description Term
Term being defined
Inline content only
<dd>
Description Details
Definition/description of term
Any flow content
Ordered List Attributes
Attribute
Values
Purpose
type
1, A, a, I, i
Numbering style
start
Number
Starting value
reversed
Boolean
Descending order
List Item Attributes:
Attribute
Purpose
value
Set specific item number (ol only)
List Nesting:
Lists can be nested infinitely
Nest lists inside <li> elements
Can mix ul and ol in nested lists
Example: Various list types and configurations
<!-- Unordered list --><ul> <li>First item</li> <li>Second item</li> <li>Third item</li></ul><!-- Ordered list with attributes --><ol type="A" start="3"> <li>Item C</li> <li>Item D</li> <li value="10">Item J (skip to 10)</li></ol><!-- Reversed numbering --><ol reversed> <li>Third</li> <li>Second</li> <li>First</li></ol><!-- Nested lists --><ul> <li>Main item 1 <ul> <li>Sub item 1.1</li> <li>Sub item 1.2</li> </ul> </li> <li>Main item 2</li></ul><!-- Description list --><dl> <dt>HTML</dt> <dd>HyperText Markup Language</dd> <dt>CSS</dt> <dd>Cascading Style Sheets</dd> <dt>JavaScript</dt> <dd>Programming language for web interactivity</dd> <dd>Also known as ECMAScript</dd></dl>
<!-- Inline code --><p>Use the <code>console.log()</code> function to debug.</p><!-- Multi-line code block --><pre><code>function greet(name) { return `Hello, ${name}!`;}console.log(greet('World'));</code></pre><!-- Sample output --><p>The program outputs: <samp>Hello, World!</samp></p><!-- Keyboard input --><p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.</p><p>Save file with <kbd><kbd>Ctrl</kbd>+<kbd>S</kbd></kbd></p><!-- Variable/placeholder --><p>Replace <var>filename</var> with your actual file name.</p><!-- ASCII art / formatted text --><pre> * ******** *** *</pre><!-- Terminal session --><pre><samp>$ npm install package-nameadded 42 packages in 3.5s</samp></pre>
Warning: <pre> preserves ALL whitespace including leading spaces and blank lines. Be
careful with indentation in your source code.
4. Inline Text Semantics (<span>, <em>, <strong>, <mark>)
Element
Purpose
Default Style
Semantic Meaning
<span>
Generic inline container
None
No semantic meaning (styling/scripting only)
<em>
Emphasis
Italic
Stress emphasis
<strong>
Strong importance
Bold
Strong importance/urgency
<mark>
Highlighted/marked text
Yellow background
Relevance/reference highlight
<i>
Alternate voice/mood
Italic
Technical terms, foreign words, thoughts
<b>
Bring attention to
Bold
Keywords, product names (no importance)
<u>
Unarticulated annotation
Underline
Spelling errors, proper names in Chinese
<s>
Strikethrough
Line through
No longer accurate/relevant
<em> vs <i>:
<em>: Stress emphasis
<i>: Different quality (technical, foreign)
Screen readers emphasize <em>
Use <em> when meaning changes with stress
<strong> vs <b>:
<strong>: Important/urgent
<b>: Stylistic offset (no importance)
Use <strong> for warnings, critical info
Use <b> for keywords without emphasis
Use Cases by Element
Element
Example Use
<mark>
Search result highlights
<i>
Foreign words, ship names
<b>
Lead paragraph keywords
<u>
Spelling mistake indication
<s>
Old price, outdated info
Example: Inline text semantics in context
<!-- Emphasis changes meaning --><p><em>I</em> didn't say that.</p><p>I <em>didn't</em> say that.</p><p>I didn't <em>say</em> that.</p><!-- Strong importance --><p><strong>Warning:</strong> This action cannot be undone.</p><!-- Highlight/mark --><p>Search results for <mark>HTML</mark> elements.</p><!-- Italic for technical/foreign terms --><p>The <i>HMS Titanic</i> sank in 1912.</p><p>The term <i lang="fr">raison d'être</i> means reason for being.</p><!-- Bold for keywords (no importance) --><p>The <b>Responsive Web Design</b> approach adapts to screen sizes.</p><!-- Strikethrough for outdated info --><p>Price: <s>$99.99</s> $49.99 (Sale!)</p><!-- Underline for spelling errors --><p>She made a <u>speling</u> mistake.</p><!-- Generic span for styling --><p>Status: <span class="status-active">Active</span></p>
5. Text Modifications (<del>, <ins>, <sub>, <sup>, <small>)
Note: <del> and <ins> are block or inline depending
on context. They can wrap paragraphs or be inline within text.
6. Abbreviations and Data (<abbr>, <data>, <var>, <time>)
Element
Purpose
Key Attribute
Display
<abbr>
Abbreviation or acronym
title (full form)
Dotted underline (tooltip on hover)
<data>
Machine-readable content
value (machine format)
Normal text (inline)
<var>
Variable/mathematical placeholder
None
Italic
<time>
Date/time (covered in 2.5)
datetime
Normal text (inline)
<dfn>
Defining instance of term
None
Italic
Abbreviation Best Practices:
Always include title attribute
Expand on first use in article
Use for both abbreviations and acronyms
Title shows on hover (desktop)
Improves accessibility for screen readers
Data Element Usage:
Links human-readable to machine-readable
Use for product codes, IDs, values
value attribute is machine format
Content is human-readable display
Useful for sorting, filtering
Example: Abbreviations and data elements
<!-- Abbreviations with title --><p>The <abbr title="World Wide Web">WWW</abbr> was invented by Tim Berners-Lee.</p><p>Use <abbr title="HyperText Markup Language">HTML</abbr> for structure.</p><p>Meeting at <abbr title="As Soon As Possible">ASAP</abbr>.</p><!-- Data element for machine-readable values --><p>Product: <data value="SKU-12345">Premium Widget</data></p><p>Rating: <data value="4.5">4.5 out of 5 stars</data></p><p>Price: <data value="49.99">$49.99</data></p><!-- Variable in mathematical context --><p>If <var>x</var> = 5, then <var>x</var> + 3 = 8</p><p>The formula is <var>f</var>(<var>x</var>) = <var>x</var><sup>2</sup></p><!-- Definition term --><p><dfn>Responsive Design</dfn> is an approach where design adapts to screen size.</p><p>A <dfn><abbr title="Application Programming Interface">API</abbr></dfn> is a set of protocols for building software.</p><!-- Combined usage --><p> <abbr title="Uniform Resource Locator">URL</abbr> format: <code><var>protocol</var>://<var>domain</var>/<var>path</var></code></p>
Note: <dfn> should be used only for the defining instance
of a term (first occurrence where it's explained), not for every mention.
Section 3 Key Takeaways
Use <p> for text paragraphs, <div> for layout/styling only
<blockquote> for extended quotes with optional cite attribute
Three list types: <ul> (unordered), <ol> (ordered), <dl> (description)
<pre> preserves whitespace; combine with <code> for code blocks
<em> for stress emphasis, <strong> for importance (not just styling)
<i> and <b> have semantic meaning (not just italic/bold)
<sub> and <sup> for subscript/superscript (formulas, footnotes)
<abbr> with title attribute improves accessibility
<data> links human-readable text to machine-readable values