HTML Formatting

Master this topic with zero to advance depth.

Expert Answer & Key Takeaways

Mastering HTML Formatting is essential for high-fidelity technical architecture and senior engineering roles in 2026.

HTML Text Formatting

HTML contains several elements for defining text with a special meaning.
<b>This text is bold</b> <i>This text is italic</i> <p>This is <sub>subscript</sub> and <sup>superscript</sup></p>

HTML Formatting Elements

Formatting elements were designed to display special types of text:
  • <b> - Bold text
  • <strong> - Important text
  • <i> - Italic text
  • <em> - Emphasized text
  • <mark> - Marked text
  • <small> - Smaller text
  • <del> - Deleted text
  • <ins> - Inserted text
  • <sub> - Subscript text
  • <sup> - Superscript text

HTML <b> and <strong> Elements

The HTML <b> element defines bold text, without any extra importance.
<b>This text is bold</b>
The HTML <strong> element defines text with strong importance. The content inside is typically displayed in bold.
<strong>This text is important!</strong>

HTML <i> and <em> Elements

The HTML <i> element defines a part of text in an alternate voice or mood. The content inside is typically displayed in italic.
<i>This text is italic</i>
The HTML <em> element defines emphasized text. The content inside is typically displayed in italic.
<em>This text is emphasized</em>
Note: A screen reader will pronounce the words in <em> with an emphasis, using verbal stress.

HTML <small> Element

The HTML <small> element defines smaller text:
<small>This is some smaller text.</small>

HTML <mark> Element

The HTML <mark> element defines text that should be marked or highlighted:
<p>Do not forget to buy <mark>milk</mark> today.</p>

HTML <del> and <ins> Elements

The HTML <del> element defines text that has been deleted from a document. Browsers will usually strike a line through deleted text.
<p>My favorite color is <del>blue</del> red.</p>
The HTML <ins> element defines a text that has been inserted into a document. Browsers will usually underline inserted text.

HTML <sub> and <sup> Elements

The HTML <sub> element defines subscript text. Subscript text appears half a character below the normal line, and is sometimes rendered in a smaller font:
<p>This is <sub>subscripted</sub> text.</p>
The HTML <sup> element defines superscript text. Superscript text appears half a character above the normal line:
<p>This is <sup>superscripted</sup> text.</p>

💡 Interactive Task

Try using <strong> for a warning message and <em> for a sarcastic comment in your code. Notice how even though they look different, they convey specific 'feelings' to the browser!

Interview Corner

❓ Interview Question

Q: What is the difference between <b> and <strong>?
A: Visually they both appear bold. However, <strong> is semantic and tells the browser/screen reader that the text is logically important, while <b> is purely stylistic without implying importance.

❓ Interview Question

Q: Which tag should I use for mathematical powers?
A: Use the <sup> (superscript) tag. For example: 10<sup>2</sup> will display as 10 squared in a web browser.

❓ Interview Question

Q: What does the <mark> tag do?
A: The <mark> tag highlights text with a background color (usually yellow) to draw attention to it, similar to using a highlighter pen on paper.

Course4All Engineering Team

Verified Expert

Frontend Architects

Focused on accessibility, semantic structure, and modern SEO, our frontend team ensures the HTML/CSS curriculum meets 2026 professional standards.

Pattern: 2026 Ready
Updated: Weekly