Skip to content
Home Tutorials Roadmaps Courses Classroom Training Blog
Log in Join free
HTML Beginner Free

Text Formatting

Lesson 7 of 16 · Headings & Text 44%

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.

Choose an answer to continue.

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.

Up next

HTML Links

Lesson 8 of 16 · Links & Images