HTML Text Formatting Guide
Semantic and presentational text formatting in HTML
<b>
Bold text (presentational)
Note: Use <strong> for semantic importance
<p>This is <b>bold</b> text.</p>
<i>
Italic text (presentational)
Note: Use <em> for semantic emphasis
<p>This is <i>italic</i> text.</p>
<u>
Underlined text
Note: Avoid - can be confused with links
<p>This is <u>underlined</u> text.</p>
<sup>
Superscript text
Note: For exponents, footnotes, etc.
<p>E = mc<sup>2</sup></p>
<sub>
Subscript text
Note: For chemical formulas, etc.
<p>H<sub>2</sub>O</p>
<strong>
Important text (semantic)
Note: Browsers typically render as bold
<p><strong>Warning:</strong> Hot surface.</p>
<em>
Emphasized text (semantic)
Note: Browsers typically render as italic
<p>You <em>must</em> complete the form.</p>
<mark>
Highlighted text
Note: Default background color is yellow
<p>Search results for <mark>HTML</mark> formatting.</p>
<small>
Smaller text
Note: Often used for legal disclaimers
<p>Regular text <small>Small disclaimer</small></p>
<del>
Deleted text
Note: Typically rendered with strikethrough
<p>Price: <del>$99</del> $79</p>
<ins>
Inserted text
Note: Typically rendered with underline
<p>My favorite color is <del>blue</del> <ins>red</ins>.</p>
<code>
Inline code snippet
Note: Monospace font by default
<p>Use the <code>printf()</code> function.</p>
<kbd>
Keyboard input
Note: Represents user keyboard input
<p>Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save.</p>
<samp>
Sample output
Note: For program output samples
<p>Output: <samp>File not found.</samp></p>
<var>
Variable name
Note: Typically rendered in italics
<p>The variable <var>x</var> represents...</p>
<abbr>
Abbreviation or acronym
Note: Use title attribute for full expansion
<p>The <abbr title="World Health Organization">WHO</abbr> was founded...</p>
<q>
Short inline quotation
Note: Browsers typically add quotation marks
<p>She said <q>Hello world!</q></p>
<cite>
Citation or reference
Note: Typically rendered in italics
<p><cite>The Scream</cite> by Edvard Munch</p>
<time>
Machine-readable date/time
Note: Use datetime attribute for parsing
<p>The event is on <time datetime="2023-12-25">Christmas</time>.</p>
<strong>
Indicates important text
Note: Screen readers may emphasize
<p><strong>Warning:</strong> Do not touch.</p>
<em>
Indicates emphasized text
Note: Screen readers may change tone
<p>You <em>must</em> complete this.</p>
<mark>
Highlighted text for reference
Note: Like a highlighter pen
<p>The <mark>key term</mark> is highlighted.</p>
<small>
Side comments and fine print
Note: For legal disclaimers, etc.
<p>Price: $9.99 <small>+ tax</small></p>
<code>
Inline code snippet
Note: For short code references
<p>Use <code>console.log()</code> for debugging.</p>
Semantic Over Presentational
Use semantic elements that convey meaning rather than just visual styling
Accessibility
Ensure text formatting works for all users, including screen readers
Moderation
Avoid excessive formatting that reduces readability
Technical Article
Product Description
Scientific Paper Excerpt
Formatting Playground
Experiment with text formatting in our live editor
Formatting Examples Preview
Ready-to-use examples covering text formatting
Basic Formatting
This is bold, italic, and underlined text.
H2O and E = mc2 examples.
Semantic Formatting
Important: This is emphasized text.
The highlighted term and code snippet
.
All examples will be loaded into an interactive editor where you can modify and test them