Text formatting starts with meaning: strong and em express importance or emphasis, while mark, del, ins, sub, and sup carry distinct semantics. CSS controls appearance.
The style attribute applies CSS directly to a single HTML element. It is useful for quick experiments, small demos, or very limited one-off styling. However, in real projects, too many inline styles make code harder to maintain because design rules get scattered throughout the markup.
In production websites, developers usually prefer internal or external stylesheets so the same design rules can be reused consistently across many elements and pages. Inline styles are best understood as a quick way to apply CSS, not as the main styling strategy for large websites.
<h1 style="color: #e74c3c; font-size: 32px;">Red Heading</h1>
<p style="background-color: #f0f0f0; padding: 10px;">Styled paragraph</p>
<div style="border: 2px solid blue; border-radius: 8px; padding: 16px;">
Bordered box
</div>
HTML includes several text formatting tags that affect the meaning or presentation of content. Some tags are semantic, which means they communicate purpose or emphasis to browsers and assistive technologies. Others are mostly visual and are used when the styling matters more than semantic meaning.
<p><strong>Bold (important)</strong></p>
<p><b>Bold (visual only)</b></p>
<p><em>Italic (emphasis)</em></p>
<p><i>Italic (visual only)</i></p>
<p><u>Underlined text</u></p>
<p><s>Strikethrough text</s></p>
<p><mark>Highlighted text</mark></p>
<p><small>Smaller text</small></p>
<p>H<sub>2</sub>O (subscript)</p>
<p>E=mc<sup>2</sup> (superscript)</p>
<p><abbr title="HyperText Markup Language">HTML</abbr> (abbreviation)</p>
<p><del>Deleted text</del> <ins>Inserted text</ins></p>
Choosing the correct formatting tag improves both readability and accessibility. For example, <strong> carries more meaning than just bold styling, while <em> indicates emphasis, not just italic text.
| Tag | Renders As | Meaning |
|---|---|---|
| <strong> | Bold | Important text (semantic) |
| <b> | Bold | Bold (visual only, no semantic meaning) |
| <em> | Italic | Emphasized text (semantic) |
| <i> | Italic | Italic (visual only - used for icons, terms) |
| <u> | Underline | Underlined text |
| <s> | Strike | No longer accurate/relevant |
| <mark> | Highlight | Highlighted/relevant text |
| <small> | Small | Fine print, side comments |
| <sub> | H2O | Subscript |
| <sup> | m2 | Superscript |
| <del> | Deleted | Deleted/removed content |
| <ins> | Inserted | Inserted/added content |
| <abbr> | Abbreviation | Abbreviation with full form in title |
One of the most important ideas in HTML formatting is the difference between semantic tags and purely visual tags. Semantic tags describe the role or meaning of the content, while visual tags mostly change its appearance.
Formatting tags appear in many everyday situations. Superscript and subscript are common in formulas, <mark> is useful for search highlights, and <abbr> helps explain shortened terms without cluttering the visible text.
<p>Water formula: H<sub>2</sub>O</p>
<p>Area formula: m<sup>2</sup></p>
<p><mark>Search result match</mark></p>
<p><abbr title="Cascading Style Sheets">CSS</abbr> styles web pages.</p>
<p><del>$99</del> <ins>$79</ins> Offer price</p>
If the goal is only to change color, font size, spacing, alignment, or layout, CSS is usually the better choice. HTML formatting tags should be used when the text itself has meaning, not just when you want a different appearance.
For example, making a word red should usually be done with CSS, while marking a word as important should use <strong>. This keeps HTML semantic and CSS presentational.
<section>
<h2>HTML Text Formatting bold italic mark del sup</h2>
<p>Use semantic structure so the content is readable and accessible.</p>
</section>
<button type="button" aria-label="Review HTML Text Formatting bold italic mark del sup">Review</button>
<code><strong></code> gives semantic importance to the text, while <code><b></code> mainly makes the text bold visually without adding semantic meaning.
<code><em></code> means emphasis and has semantic value, while <code><i></code> is usually used for visual italics or special text conventions.
Inline styles are acceptable for small examples and one-off cases, but external or internal CSS is better for maintainability in real projects.
Explore 500+ free tutorials across 20+ languages and frameworks.