HTML Text Formatting

Introduction

HTML provides several tags that allow developers to format text on a webpage. Text formatting helps highlight important words, emphasize content, and improve the readability of the page.

Using text formatting elements, you can make text bold, italic, underlined, highlighted, smaller, or emphasized. These formatting tags help organize information and make the content easier for users to understand.

In this lesson, you will learn how to use the most common HTML text formatting tags and understand when to use them correctly.

What You’ll Learn

In this tutorial, you will learn:

  • What HTML text formatting is
  • Common text formatting tags
  • Difference between <b> and <strong>
  • Difference between <i> and <em>
  • How to highlight, underline, or strike text
  • Best practices for text formatting in HTML

What is HTML Text Formatting?

HTML text formatting refers to the use of specific tags that change the appearance or importance of text.

These formatting tags help:

  • Emphasize important words
  • Improve readability
  • Structure content visually
  • Provide meaning for browsers and search engines

For example, you may want to highlight a warning message or emphasize a key term in an article. HTML formatting tags allow you to do this easily.

Common HTML Text Formatting Tags

HTML provides several tags for formatting text. Some of the most commonly used formatting tags include:

  • <b> – Bold text
  • <strong> – Important text
  • <i> – Italic text
  • <em> – Emphasized text
  • <mark> – Highlighted text
  • <small> – Smaller text
  • <del> – Deleted text
  • <ins> – Inserted text
  • <sub> – Subscript text
  • <sup> – Superscript text

Each tag has a specific purpose and helps present information more clearly.

1️⃣ Bold and Strong Text

The <b> tag is used to make text bold.

Example:

<p>This is <b>bold text</b>.</p>

The <strong> tag is used to indicate important text.

Example:

<p>This is <strong>important text</strong>.</p>

Difference Between <b> and <strong>

Both tags display bold text in browsers, but they have different meanings.

  • <b> only changes the visual appearance of the text.
  • <strong> indicates that the text is important.

Because <strong> adds meaning, it is often preferred for important content.

2️⃣ Italic and Emphasized Text

The <i> tag is used to display italic text.

Example:

<p>This is <i>italic text</i>.</p>

The <em> tag is used to emphasize text.

Example:

<p>This is <em>emphasized text</em>.</p>

Difference Between <i> and <em>

Both tags appear italic in most browsers, but they serve different purposes.

  • <i> is used for styling text.
  • <em> indicates that the text should be emphasized.

Search engines and screen readers can understand emphasis provided by <em>.

3️⃣ Underline Text

<u>This text is underlined</u>

⚠️ Use rarely (can confuse with links).

4️⃣ Small Text

The <small> tag is used to display smaller text.

Example:

<p>This is <small>smaller text</small>.</p>

This tag is often used for:

  • Copyright information
  • Notes
  • Disclaimers

5️⃣ Highlighted Text

The <mark> tag is used to highlight text.

Example:

<p>This is <mark>highlighted text</mark>.</p>

The highlighted text usually appears with a yellow background in most browsers. It is useful for marking important information.

6️⃣ Line Break

Hello<br>
Welcome to Div PHP Tutorials

Creates a new line without starting a new paragraph.

7️⃣ Horizontal Line

<hr>

Creates a horizontal divider line.

Deleted and Inserted Text

HTML also provides tags to show text changes.

Deleted Text

The <del> tag represents text that has been removed.

Example:

<p>The price is <del>$50</del> $40.</p>

The deleted text appears with a strikethrough line.

Inserted Text

The <ins> tag represents newly added text.

Example:

<p>This is <ins>newly added text</ins>.</p>

Browsers usually display inserted text with an underline.

Subscript and Superscript

Subscript and superscript are used in mathematical or scientific expressions.

Subscript

The <sub> tag displays text slightly below the normal line.

Example:

<p>Water formula is H<sub>2</sub>O.</p>

Superscript

The <sup> tag displays text slightly above the normal line.

Example:

<p>10<sup>2</sup> = 100</p>

These tags are commonly used in:

  • Mathematical formulas
  • Chemical equations
  • Footnotes

Complete Example

<!DOCTYPE html>
<html>
<head>
    <title>HTML Text Formatting</title>
</head>
<body>

<p><strong>HTML</strong> is used to create <em>web pages</em>.</p>

<p>This is <b>bold</b> and this is <i>italic</i>.</p>

<p><mark>Practice daily</mark> to learn faster.</p>

<p>Line break example:<br>New line starts here.</p>

<hr>

<small>© 2026 Div PHP Tutorials</small>

</body>
</html>

Key Points to Remember

  • Use <strong> instead of <b> for importance
  • Use <em> instead of <i> for emphasis
  • Formatting improves readability
  • Don’t overuse formatting tags

In the next tutorial, we’ll learn about HTML Links.

Related Tutorials

  • HTML Introduction

    👋 First time learning web development?We recommend starting with our Start Here guide before continuing this lesson. It will help you understand the learning path for HTML, CSS, PHP, and WordPress. Introduction HTML stands for HyperText Markup Language. It is the basic building block of every website on the internet. HTML is used to create…

  • HTML Basic Structure

    Introduction This basic HTML page structure is also known as an HTML skeleton or HTML boilerplate template. In this lesson, you will learn the basic structure of an HTML document and understand what each part does. What You’ll Learn in This Lesson Basic HTML Document Structure (HTML Boilerplate) The basic HTML structure is sometimes called…

  • HTML Headings & Paragraphs

    Introduction Headings and paragraphs are among the most commonly used elements in HTML. They help structure the content and make web pages readable and well-organized. Headings are used to define titles and sections of a webpage, while paragraphs are used to display blocks of text. By using headings and paragraphs properly, developers can organize information…

  • HTML Links

    Introduction HTML links are used to connect one page to another page. They allow users to move between different web pages, websites, or sections of the same page. Links are a fundamental part of the web. Without links, browsing the internet would not be possible. They also play an important role in SEO by helping…

  • HTML Images

    Introduction Images are an important part of any webpage. They make content more attractive, engaging, and easier to understand. In HTML, images are used to display pictures such as photos, icons, logos, and graphics on a webpage. Adding images helps improve user experience and also makes your content visually appealing. In this lesson, you will…

  • HTML Lists

    Introduction HTML lists are used to display items in an organized way. They help structure content clearly and make it easier for users to read and understand information. Lists are commonly used in menus, steps, features, and grouped data on websites.In this lesson, you will learn how to create different types of lists in HTML…

Leave a Reply

Your email address will not be published. Required fields are marked *