HTML Text Formatting

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 6 Examples + 6 Try It
strong, em, mark

Introduction

HTML text formatting lets you style words and phrases inside paragraphs—bold, italic, highlighted, struck-through, and more. These inline elements change appearance and, when you choose semantic tags, add meaning that helps screen readers and search engines understand your content.

Understanding formatting tags is essential for readable, accessible web pages. This tutorial covers the most common tags, when to use each one, and how to combine them safely.

What You’ll Learn

01

strong / b

Bold text.

02

em / i

Italic text.

03

mark

Highlight.

04

del / ins

Edits.

05

Nesting

Combine tags.

06

a11y

Semantic HTML.

What Is HTML Text Formatting?

HTML text formatting refers to inline elements that wrap part of a sentence or heading to change its style or meaning. Unlike block elements (like <p> or <h1>) that start on a new line, formatting tags flow inside existing text.

Tags fall into two groups:

  • Semantic — convey meaning (<strong>, <em>, <mark>, <del>, <ins>).
  • Presentational — change look only (<b>, <i>, <u>).
💡
Beginner Tip

When in doubt, pick the semantic tag. <strong> instead of <b> and <em> instead of <i> helps everyone—including users who cannot see bold or italic styling.

Common Text Formatting Tags

Here are the most widely used HTML text formatting elements:

  • <b> — bold without semantic importance.
  • <strong> — bold with strong importance (strong tag tutorial).
  • <i> — italic without semantic emphasis.
  • <em> — italic with stressed emphasis (em tag tutorial).
  • <u> — underlined text (not for links).
  • <mark> — highlighted text, like a yellow marker.
  • <small> — side comments, fine print, or legal text.
  • <del> — deleted (struck-through) content.
  • <ins> — inserted (underlined) content.
  • <sub> / <sup> — subscript and superscript (H2O, x2).

Semantic vs Presentational Tags

Visual effectSemantic (preferred)Presentational
Bold<strong> — important<b> — style only
Italic<em> — stress<i> — alternate voice
Underline<ins> — inserted text<u> — unarticulated annotation
Strikethrough<del> — removed text<s> — no longer accurate

Browsers style these tags by default, but you can override appearance with CSS. Semantic meaning stays even if you change fonts or colors.

Styling Text for Emphasis

Use <strong>, <em>, and <mark> to draw attention while adding meaning:

html
<p>This is a <strong>bold statement</strong> with
  <em>italic emphasis</em> and <mark>highlighted text</mark>.</p>
  • strong — key point or warning.
  • em — spoken stress on a word.
  • mark — search hit or newly relevant phrase.

Structuring Content with Semantic Tags

Semantic tags help assistive technology and search engines interpret your page:

html
<p><strong>Important:</strong> Always validate user input.</p>
<p>She <em>really</em> loves coding.</p>

Screen readers may pronounce <em> with different intonation. <strong> signals that the label “Important” is more than decoration—it introduces critical information.

Combining Text Formatting Tags

Nested tags combine effects. Open and close in reverse order (like stacking boxes):

html
<p>This is <strong><em>very important</em></strong> text.</p>

Result: bold and italic. Keep nesting shallow—two levels is usually enough.

Showing Edits with del and ins

When content changes over time, <del> and <ins> document what was removed and added:

html
<p>Price: <del>$99</del> <ins>$79</ins></p>
<p>Step 2: <del>Click Save</del> <ins>Click Publish</ins></p>

Browsers strike through del and underline ins by default. Pair with datetime attributes for machine-readable timestamps when needed.

Accessibility Considerations

  • Prefer <strong> and <em> over <b> and <i> when meaning matters.
  • Do not rely on color or formatting alone—include clear words (“Warning”, “New”).
  • Avoid using <u> for links; use <a href> instead.
  • Ensure sufficient color contrast if you style mark or custom bold colors with CSS.
  • Keep sentences readable when heard by a screen reader—do not bold every other word.

⚡ Quick Reference

GoalTagExample
Important text<strong><strong>Warning</strong>
Stressed word<em>She <em>loves</em> it
Highlight<mark><mark>search term</mark>
Fine print<small><small>Terms apply</small>
Removed text<del><del>old price</del>
Added text<ins><ins>new price</ins>
Bold + italicnested<strong><em>text</em></strong>

Examples Gallery

Six examples from a single emphasis line to a full formatting demo. Each includes View Output and Try It Yourself where noted.

📚 Getting Started

Bold, italic, and highlight in one paragraph.

Example 1 — Emphasis with strong, em, and mark

html
<p>This is a <strong>bold statement</strong> with
  <em>italic emphasis</em> and <mark>highlighted text</mark>.</p>
Try It Yourself

How It Works

Each tag wraps only the words that need that style. The rest of the sentence stays normal paragraph text.

Example 2 — Semantic strong and em

html
<p><strong>Important:</strong> Always validate user input.</p>
<p>She <em>really</em> loves coding.</p>
Try It Yourself

How It Works

strong labels the warning; em stresses the word “really” in the second sentence.

📈 Combining & Revisions

Nested tags and edit tracking.

Example 3 — Nested strong and em

html
<p>This is <strong><em>very important</em></strong> text.</p>
Try It Yourself

How It Works

em is inside strong, so the phrase is both bold and italic.

Example 4 — Deleted and inserted text

html
<p>Price: <del>$99</del> <ins>$79</ins></p>
<p><del>Deleted text</del> and <ins>inserted text</ins>.</p>
Try It Yourself

How It Works

Common on sale pages and documentation changelogs. See also del and ins tag tutorials.

Example 5 — small and u

html
<p>Main offer <small>(terms and conditions apply)</small></p>
<p>The word <u>correct</u> was misspelled above.</p>
Try It Yourself

How It Works

small shrinks legal or secondary notes. u underlines without implying a link.

Example 6 — Complete HTML Page

A full page demonstrating the main formatting tags together:

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>HTML Text Formatting Example</title>
</head>
<body>
  <h1>HTML Text Formatting Example</h1>
  <p>This is an example of <strong>bold text</strong>,
     <em>italic text</em>, and <u>underlined text</u>.</p>
  <p>You can also <mark>highlight text</mark> or use
     <small>smaller text</small>.</p>
  <p><del>Deleted text</del> and <ins>inserted text</ins>
     are also supported.</p>
</body>
</html>
Try It Yourself

How It Works

Matches the classic tutorial conclusion—open Try It to edit and preview every tag in the browser.

🚀 Common Use Cases

  • Warnings and tips<strong>Note:</strong> before critical instructions.
  • Product pagesdel + ins for old and new prices.
  • Search resultsmark around matched keywords.
  • Documentation — show edits with del and ins.
  • Legal footnotessmall for disclaimers.
  • Science & mathsub and sup for formulas.

🧠 How Text Formatting Works in HTML

1

Write paragraph

Start with <p> or a heading element.

Block
2

Wrap words

Add inline tags around the phrase to format.

Inline
3

Browser styles

Default CSS makes strong bold, em italic, etc.

Render
=

Readable content

Formatted text with optional semantic meaning for SEO and a11y.

💡 Best Practices

✅ Do

  • Use strong and em for meaningful emphasis
  • Use del / ins for real document changes
  • Keep nesting shallow (one or two levels)
  • Override default styles with CSS when branding requires it
  • Link to detailed tag pages for deep dives

❌ Don’t

  • Bold entire paragraphs for “design”—use headings or CSS
  • Use u for navigation links
  • Rely on bold/italic alone to convey critical info
  • Stack more than two or three inline tags
  • Use formatting tags for page layout (use CSS instead)

Universal Browser Support

All text formatting tags listed here are part of HTML5 and supported in every modern browser. Default styling (bold, italic, strikethrough) works without CSS.

Baseline · Since HTML

Text formatting tags

All text formatting tags listed here are part of HTML5 and supported in every modern browser. Default styling (bold, italic, strikethrough) works without CSS.

99% Modern browser support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
Text formatting tags Excellent

Bottom line: Safe to use everywhere. Customize appearance with CSS; semantic roles remain in the DOM.

Conclusion

HTML text formatting gives you simple, built-in tools to emphasize words, highlight search terms, and show edits. Choose semantic tags when meaning matters, nest carefully, and keep accessibility in mind.

For deeper coverage of individual elements, explore strong, em, and mark. Next, learn how to add non-displayed notes with HTML comments.

Key Takeaways

💬 02

em

Stress.

Semantic
🔖 03

mark

Highlight.

Search
✂️ 04

del / ins

Edits.

Revisions
05

Meaning

Not just style.

a11y

❓ Frequently Asked Questions

HTML text formatting means using inline elements like strong, em, mark, and del inside paragraphs and headings to change how text looks and what it means. Tags wrap words or phrases—you do not need CSS for basic bold, italic, or highlight effects.
Both often appear bold visually. strong adds semantic importance—use it for warnings, key terms, or critical info. b is presentational only; use it when bold is purely decorative (e.g. a product name in a list) and strong would mislead assistive tech.
em indicates stressed emphasis and may change how screen readers speak the word. i is for alternate voice or mood (foreign words, technical terms, thoughts) without strong stress. Prefer em when emphasis matters for meaning.
The u element underlines text. In modern UI, underlines usually mean links, so use u sparingly—spelling corrections, proper names in Chinese, or legal text. For links, use the a element instead.
del marks deleted content (old price, removed step). ins marks newly inserted content. Together they show document revisions—useful for changelogs, edited articles, and version history.
Yes. Nest tags inside out: <strong><em>very important</em></strong> produces bold italic text. Close tags in reverse order. Avoid deep nesting—it hurts readability for humans and screen readers.
Did you know?

Before CSS was widely used, authors relied on <font> and <center> for styling. HTML5 removed many presentational tags in favor of semantic elements plus CSS. Text formatting tags like strong and em survived because they describe meaning, not just appearance.

Format text in the editor

Open Try It, wrap words with strong and em, and see bold and italic styling update live.

Open Try It editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful