HTML Text Formatting
Learn how to properly format text in HTML with semantic meaning
<strong>, <b>
Bold text - <strong> for important text, <b> for stylistic bold
<p><strong>Important text</strong> and <b>bold text</b></p>
<strong> is semantic, <b> is presentational
<em>, <i>
Italic text - <em> for emphasized text, <i> for stylistic italic
<p><em>Emphasized text</em> and <i>italic text</i></p>
<em> is semantic, <i> is presentational
<u>
Underlined text (avoid for links to prevent confusion)
<p><u>Underlined text</u> example</p>
Presentational only
<mark>
Highlighted text for reference or notation purposes
<p>This is <mark>highlighted text</mark></p>
Semantic - indicates relevance
<code>
Inline code snippet or computer code
<p>Use <code>console.log()</code> for debugging</p>
Semantic - indicates code
<sub>
Subscript text (lowered and smaller)
<p>Chemical formula: H<sub>2</sub>O</p>
Semantic - indicates subscript
<sup>
Superscript text (raised and smaller)
<p>Mathematical notation: x<sup>2</sup></p>
Semantic - indicates superscript
<del>, <ins>
Deleted and inserted text (for document edits)
<p><del>$100</del> <ins>$80</ins> (limited time)</p>
Semantic - indicates changes
<strong> vs <b>
<strong> indicates importance, <b> is just visual boldness
<em> vs <i>
<em> adds verbal stress, <i> is just visual italic
<mark>
Indicates text that is relevant or should be highlighted
<del> & <ins>
Shows document edits with semantic meaning
Semantic vs Presentational
Use semantic elements when meaning is important
Recommended
Avoid
Avoid Overuse
Don't overuse formatting as it loses effectiveness
Recommended
Avoid
CSS for Styling
Use CSS for purely visual formatting
Recommended
Avoid
Accessibility
Ensure proper contrast and readable text
Recommended
Avoid
Academic Paper Formatting
Technical Documentation
E-commerce Product Page
Text Formatting Playground
Experiment with HTML text formatting in our live editor
Formatting Examples Preview
Ready-to-use examples covering different formatting scenarios
Formatting Elements
All examples will be loaded into an interactive editor where you can modify and test them