HTML Text Formatting

Bold, italic, highlighted, small, deleted and more.

✍️ 3 exercises + code challenge in this lesson

HTML has elements that give text special meaning or appearance:

  • <b> bold text, and <strong> important text.
  • <i> italic text, and <em> emphasised text.
  • <mark> highlighted text.
  • <small> smaller text.
  • <del> deleted text and <ins> inserted text.
  • <sub> subscript and <sup> superscript.
Prefer <strong> and <em>: they describe meaning, which helps screen readers.

Key Takeaways: HTML Text Formatting

Mastering HTML Text Formatting helps you write clean and reliable HTML code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

HTML Text Formatting Code Example

HTML
<p><b>Bold</b> and <strong>strong</strong></p>
<p><i>Italic</i> and <em>emphasised</em></p>
<p>Do not forget to <mark>save your work</mark>.</p>
<p><small>This is small print.</small></p>
<p>Price: <del>Rs 5,000</del> <ins>Rs 3,500</ins></p>
<p>H<sub>2</sub>O and E = mc<sup>2</sup></p>
Free sign-in required · Google login available

HTML Text Formatting Practice Exercises

Check what you learned in “HTML Text Formatting”.

/ 3 solved
Fill in the blank

Mark the text as highlighted.

<p>Remember to <>save</> your work.</p>
✓ Correct! Not quite. Try again.
Multiple choice

Which element shows subscript text, like the 2 in H₂O?

✓ Correct! Not quite. Try again.
Code challenge

Show "Rs 500" as deleted text (<del>) followed by "Rs 300" as inserted text (<ins>).

Write the code in the live editor. Your answer is checked automatically.

Free sign-in required · Google login available

to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services