Skip to content
Home Tutorials Roadmaps Courses
Log in Join free
Tutorials HTML Text Formatting
HTML Beginner FREE

Text Formatting

Lesson 3 of 16 Beginner Interactive

HTML provides several tags to format text and make it stand out.

Common Formatting Tags

  • <strong>Bold and important
  • <b>Bold but not important
  • <em>Italic and emphasized
  • <i>Italic but not emphasized
  • <u>Underlined
  • <s>Strikethrough
  • <mark>Highlighted
  • <small>Small text
  • <sub> — H2O (subscript)
  • <sup> — E=mc2 (superscript)

Tip: Prefer <strong> over <b> because it adds semantic meaning for screen readers and SEO.

Syntax

HTML
<strong>Bold</strong>
<em>Italic</em>
<u>Underlined</u>
<s>Strikethrough</s>
<mark>Highlighted</mark>
<small>Small text</small>
Text Formatting Tags
HTML
<!DOCTYPE html>
<html>
<body>
    <p>This is <strong>bold text</strong>.</p>
    <p>This is <em>italic text</em>.</p>
    <p>This is <mark>highlighted text</mark>.</p>
    <p>This is <small>small text</small>.</p>
    <p>This is <del>deleted text</del>.</p>
    <p>This is <sub>subscript</sub> and <sup>superscript</sup>.</p>
</body>
</html>

Practice

1
Exercise

Write a paragraph where "very important" is bold and "note" is italic.

Answer
<p>This is a <strong>very important</strong> <em>note</em>.</p>

Quick Quiz

1

Which tag is semantically correct for important text?

<strong> is the semantically correct tag for important text.

Interview Questions

<strong> indicates that the text is important and adds semantic meaning. <b> simply makes text bold visually without conveying importance. Screen readers treat them differently.