HTML Text Formatting Tags
HTML gives you a rich set of inline tags to format and add meaning to text — bold, italic, highlighted, deleted, inserted, subscript, superscript, and more. In this chapter you'll learn every text formatting tag, when to use each one, and the critical difference between semantic and presentational tags.
<strong> vs
<b>, and <em> vs <i>
<del> & <ins>Semantic vs Presentational Tags
Before diving into individual tags, it's important to understand this key distinction. HTML has two types of text formatting tags:
<strong>, <em>, <mark>, <del>, <ins>. Use these whenever the meaning matters.<b>, <i>, <u>. Use these only
when the visual style is the sole intent, with no semantic importance.<strong> instead of <b>, and <em> instead of
<i> — unless you have a specific reason for presentational-only
styling.
All HTML Text Formatting Tags
Here is a complete reference of every HTML text formatting tag with a live preview, its type, and when to use it:
<em>
text.<del> to show document edits.
<u> text can confuse users. Never use to simulate hyperlinks.
title attribute provides the full
expansion shown on hover. Helps screen readers and search engines understand abbreviated terms.Semantic vs Presentational — Quick Reference
Here is a side-by-side reference showing equivalent semantic and presentational tag pairs:
| Semantic Tag | Presentational Equivalent | Visual Output | When to Use Semantic |
|---|---|---|---|
| <strong> | <b> |
Bold | Content is critically important |
| <em> | <i> |
Italic | Text stress changes sentence meaning |
| <del> | <s> |
Text was removed / is no longer valid | |
| <ins> | <u> |
Underline | Text was newly added to the document |
| <small> | CSS font-size: smaller |
Smaller | Fine print, legal notices, copyright |
Code Examples — All Tags in Action
Here are all the formatting tags demonstrated together in one working block:
<!-- Semantic — Bold & Italic -->
<p><strong>Warning:</strong> Do not skip this step.</p>
<p>The answer is <em>always</em> in the documentation.</p>
<!-- Highlighted text -->
<p>Search result: <mark>HTML tutorial</mark> found.</p>
<!-- Deleted and inserted text -->
<p>Price: <del>₹2,999</del> <ins>₹1,499</ins></p>
<!-- Superscript and Subscript -->
<p>Water formula: H<sub>2</sub>O</p>
<p>Einstein: E = mc<sup>2</sup></p>
<!-- Small text -->
<p>Sign up free <small>(No credit card required)</small></p>
<!-- Abbreviation -->
<p>Learn <abbr title="HyperText Markup Language">HTML</abbr> today.</p>
<!-- Presentational (use sparingly) -->
<p><b>Bold</b> — visual only. <i>Italic</i> — visual only.</p>
Combining Formatting Tags
You can nest formatting tags inside each other to combine effects. The key rule is to always close the inner tag before the outer tag.
<!-- Correct — inner tag closed first -->
<p><strong><em>Bold and italic together</em></strong></p>
<p><mark><strong>Highlighted important text</strong></mark></p>
<!-- Wrong — tags overlapping (invalid HTML) -->
<p><strong><em>Text</strong></em></p> <!-- ❌ wrong order -->
<strong> then <em>, you
must close </em> first, then </strong>.
Common Mistakes — Do's & Don'ts
These are the most frequent text formatting mistakes beginners make:
<p>
<strong>Important:</strong> Save your work.
</p>
<p>Price: <del>₹999</del>
<ins>₹499</ins></p>
<abbr title="Cascading Style Sheets">
CSS
</abbr>
<!-- Using <b> when content is important -->
<p><b>Warning: fire hazard</b></p>
<!-- <u> looks like a link — confusing -->
<p><u>Click here</u></p>
<!-- Wrong nesting order -->
<strong><em>text</strong></em>
Complete Example — Formatting in a Real Page
Here is a realistic example combining multiple formatting tags inside a product description block:
<article>
<h2>Web Development Course</h2>
<p>
Master <strong>HTML, CSS & JavaScript</strong> in just
<em>8 weeks</em> with hands-on projects.
</p>
<p>
Limited time offer:
<del>₹4,999</del>
<ins>₹1,999</ins>
— <mark>50% off today only!</mark>
</p>
<p>
Taught by <abbr title="K2infocom Training Institute">K2</abbr>
certified instructors with 10<sup>+</sup> years experience.
</p>
<p><small>*Offer valid until seats fill up. Terms apply.</small></p>
</article>
Try It Yourself
Edit the formatting tags below and click Open in Editor to see them live in full screen.
<abbr> element in the preview — you'll see the full
title text appear as a tooltip. This is built-in browser behaviour with no JavaScript needed.
Quick Check — Chapter 5
Expand each question to reveal the full answer before testing yourself with the quiz below.
<strong> is a semantic tag — it tells the
browser, screen readers, and search engines that the content is of strong importance or urgency. <b> is a presentational tag — it only applies
bold styling with no added meaning. Always prefer <strong>
when the content is genuinely important.
<del> and <ins> are
often used together to show document edits or price changes. <del> marks text that was removed (renders with strikethrough) and
<ins> marks the replacement text (renders with underline). A
classic example is showing a sale price: <del>₹2,999</del> <ins>₹999</ins>. They are
semantic tags — browsers and screen readers understand they represent document revisions.
<mark> tag highlights text with a yellow
background by default. Semantically it means the highlighted content is relevant to
the user's current context — the most common use case is highlighting search keywords in
search results. Unlike <strong> which signals importance,
<mark> signals relevance or attention without implying
importance.
<sub> renders text as subscript — below the
baseline and smaller. It is used for chemical formulas (H2O), mathematical notation, and
footnote markers. <sup> renders text as
superscript — above the baseline and smaller. It is used for mathematical exponents
(mc2), ordinal indicators (1st), and footnote references. Both are semantic tags.
<u> tag renders underlined text, but browsers also
underline hyperlinks by default. Using <u> for non-link
content can confuse users who may think the underlined text is a clickable link. If you
need underline styling, use CSS (text-decoration: underline) on a
<span>. The only valid HTML5 use of <u> is for marking up proper nouns in Chinese text or indicating
spelling errors.
<abbr> tag marks an abbreviation or
acronym. The title attribute holds the full expanded form
— for example: <abbr title="HyperText Markup Language">HTML</abbr>. When a
user hovers over the abbreviation in a browser, a tooltip automatically appears showing the full title
text. Screen readers also read out the full expansion. This improves both accessibility and
clarity with no JavaScript required.
<abbr> tag?- Semantic tags carry meaning — prefer
<strong>over<b>, and<em>over<i>, for better accessibility and SEO. <strong>= bold + important.<em>= italic + stressed.<b>= bold only.<i>= italic only.<mark>highlights text as relevant in the current context — ideal for search result keywords.<del>marks removed text (strikethrough).<ins>marks inserted text (underline). Use them together for price changes and edits.<sub>= subscript (H2O).<sup>= superscript (mc2). Both are semantic tags for scientific and mathematical notation.<small>is for fine print and side comments.<abbr title="...">provides a tooltip with the full expansion of an abbreviation.- Always close nested tags in reverse order — inner tag first, then outer. Overlapping tags are invalid HTML.
Rate Us on Google
Join Our Learning Community
Connect with thousands of learners, get daily tips, ask questions, and stay updated with new tutorials.