MyInternships.in

HTML Basics

HTML Text Formatting

HTML has a set of tags for emphasising and styling text. Some carry real meaning, like importance and emphasis, while others are purely visual — knowing the difference matters.


What is HTML Text Formatting?

Text formatting tags change how words look and, in some cases, what they mean. For example, <strong> makes text bold and tells browsers the text is important, while <b> only makes text bold with no added meaning.

Preferring the meaningful tags — <strong> and <em> over <b> and <i> — helps search engines and screen readers understand your content. Both look the same, but only one conveys intent.

Basic Usage

Emphasis and importance
Example
<p><strong>Warning:</strong> this action <em>cannot</em> be undone.</p>

Example: All the Common Formatting Tags

See each tag render
Example
<!DOCTYPE html>
<html>
<body>
  <p><b>Bold</b> and <strong>important</strong> text.</p>
  <p><i>Italic</i> and <em>emphasised</em> text.</p>
  <p><mark>Highlighted</mark> and <small>small</small> text.</p>
  <p><del>Deleted</del> and <ins>inserted</ins> text.</p>
  <p>H<sub>2</sub>O and E = mc<sup>2</sup></p>
</body>
</html>

More Examples

A price with a strikethrough
Example
<p>Course price: <del>$99</del> <strong>$49</strong> today only!</p>
Subscript and superscript in formulas
Example
<p>Water is H<sub>2</sub>O.</p>
<p>The area is 10 cm<sup>2</sup>.</p>

Formatting Tags Reference

TagRenders asMeaning
<strong>BoldImportant content
<b>BoldStylistic bold, no meaning
<em>ItalicEmphasised content
<i>ItalicStylistic italic, no meaning
<mark>HighlightedRelevant / highlighted text
<small>SmallerFine print, side notes
<del>StrikethroughRemoved text
<ins>UnderlineAdded text
💡

Prefer <strong> and <em> over <b> and <i> when the text truly is important or emphasised. They mean the same visually but carry semantics for accessibility and SEO.

⚠️

Do not use text formatting tags to build layout or to fake headings. Use headings for titles and CSS for visual styling.

Key Takeaways

  • <strong> and <em> add meaning; <b> and <i> are purely visual.
  • <mark> highlights, <small> shrinks, <del> and <ins> show edits.
  • <sub> and <sup> handle subscripts and superscripts.
  • Choose tags by meaning first, then style with CSS.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships