Tutorials HTML Text Formatting
Ch 5 / 40
Chapter 5 Beginner 8 min read HTML

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.

What you'll learn
All HTML text formatting tags and what they render
The difference between semantic and presentational tags
When to use <strong> vs <b>, and <em> vs <i>
How to mark deleted and inserted text with <del> & <ins>
Subscript, superscript, small, and highlighted text
Combining formatting tags and common mistakes to avoid

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:

Semantic Tags
Carry meaning about the content. Screen readers, search engines, and browsers all interpret them differently. Examples: <strong>, <em>, <mark>, <del>, <ins>. Use these whenever the meaning matters.
Presentational Tags
Only control visual appearance — no semantic meaning is added. Examples: <b>, <i>, <u>. Use these only when the visual style is the sole intent, with no semantic importance.
Best Practice
Always prefer semantic tags. They improve accessibility, SEO, and make your code more meaningful. Use <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:

<strong> Strong Semantic
This text is strongly important
Renders bold. Tells browsers and screen readers the text is of strong importance. Use for warnings, key terms, or critical content.
<em> Emphasis Semantic
This text is emphasised
Renders italic. Signals stressed emphasis — the kind that changes the meaning or tone of a sentence. Screen readers may change vocal tone for <em> text.
<mark> Highlight Semantic
Search result: HTML tutorial found
Renders with a yellow highlight background. Semantically means the text is relevant or highlighted in the current context — commonly used for search results.
<del> Deleted Semantic
Price: ₹2,999 ₹1,499
Renders with a strikethrough. Semantically means the text has been removed or is no longer accurate. Common for price changes, edits, or corrections.
<ins> Inserted Semantic
Updated: new content added here
Renders with an underline. Semantically means the text has been inserted or added to the document. Often paired with <del> to show document edits.
<small> Small Semantic
Sign up free (No credit card required)
Renders text at a smaller font size. Semantically used for fine print, legal text, copyright notices, or side comments that are less important.
<sub> Subscript Semantic
H2O  ·  CO2
Renders text below the baseline at a smaller size. Used for chemical formulas, mathematical notation, and footnote markers.
<sup> Superscript Semantic
E = mc2  ·  10th place
Renders text above the baseline at a smaller size. Used for mathematical exponents, ordinal indicators (1st, 2nd), and footnote references.
<b> Bold Presentational
Bold text — visual only
Renders bold but carries no semantic importance. Use only when you want bold styling without implying that the content is critical or important.
<i> Italic Presentational
Italic text — visual only
Renders italic with no semantic stress. Appropriate for technical terms, foreign words, book titles, or names where italics are a typographic convention.
<u> Underline Presentational
Underlined text — visual only
Renders with an underline. Use sparingly — browsers style links with underlines, so <u> text can confuse users. Never use to simulate hyperlinks.
<abbr> Abbreviation Semantic
Learn HTML today
Marks an abbreviation or acronym. The 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> Strikethrough 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:

HTML — Text Formatting Tags
<!-- 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.

HTML — Combining Tags (correct nesting)
<!-- 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 -->
Nesting Rule
Tags must be closed in the reverse order they were opened — like stacking and unstacking boxes. If you open <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:

Do — Correct
<p>
  <strong>Important:</strong> Save your work.
</p>

<p>Price: <del>₹999</del>
  <ins>₹499</ins></p>

<abbr title="Cascading Style Sheets">
  CSS
</abbr>
Don't — Wrong
<!-- 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:

HTML — Product Card with Text Formatting
<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.

Live Editor
✎ Editor
👁 Preview
Try This
Hover over the <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.
Free Resource
HTML5 Cheat Sheet — All Tags & Attributes
One printable PDF covering every HTML5 tag including all text formatting tags, attributes, and semantic elements. Perfect for quick reference.
Download PDF
Featured Course — Enroll Now
Modern Web Development With AI
Master HTML, CSS, JavaScript, React, and Node.js in one industry-ready curriculum with real projects and placement support.
120+
Chapters
40 hrs
Content
10
Projects
4.9 ⭐
Rating
HTML5 CSS3 JavaScript React.js Node.js MongoDB AI Tools

Quick Check — Chapter 5

Expand each question to reveal the full answer before testing yourself with the quiz below.

Questions & Answers
Both render text in bold, but they have different semantic meanings. <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.
The <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.
The <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.
The <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.
Multiple Choice Questions
MCQ 1 of 4
Which tag renders bold text with semantic importance?
MCQ 2 of 4
Which tag is used to show text that has been deleted or is no longer valid?
MCQ 3 of 4
Which tag would you use to write the chemical formula H₂O correctly in HTML?
MCQ 4 of 4
Which attribute provides the expanded text for an <abbr> tag?
Chapter Summary
  • 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.
~8 min read
Beginner level
Chapter 5 of 40

Rate Us on Google

4.8 / 5
Enjoying this tutorial?
If this tutorial helped you, a 5-star Google review means a lot. It helps other learners discover our free content and motivates us to keep improving.
500+ Reviews (Target)
Write a Google Review
Join WhatsApp Channel