Advertisement

Google Ad Slot: content-top

Formating

~1 min read · HTML
On this page

In HTML, formatting tags are used to style text and change its presentation. These tags are applied within text elements to adjust their appearance, such as making text bold, italicized, or underlined.


Common Formatting Tags in HTML

  • Bold Text
  • Strong Text
  • Italic Text
  • Emphasized Text
  • Underlined Text
  • Strike Text
  • Deleted Text
  • Superscript Text
  • Subscript Text
  • Preformatted Text
  • Small Text
  • Marked Text

Bold and Strong Text: <b> and <strong>

  • <b>: Makes text bold without implying any special importance.
  • <strong>: Makes text bold and also indicates that the text has strong importance
Example

This is bold text using the b tag.

This is strongly emphasized text using the strong tag.

Try it yourself

Italic and Emphasize Text: <i> and <em>

  • <i>: Makes text italicized without implying emphasis.
  • <em>: Makes text italicized and also indicates that the text has emphasized importance.
Example

This is italicized text using the i tag.

This is emphasized text using the em tag.

Try it yourself

Underline Text: <u>

  • <u>: Underlines text, which is typically used for indicating links. In modern HTML, its use for general text styling is discouraged in favor of CSS.
Example

This is underlined text using the u tag.

Try it yourself

Strikethrough and Delete Text: <s> and <del>

  • <s>: Strikes through text to indicate that it is no longer accurate or relevant.
  • <del>: Indicates text that has been deleted from a document.
Example

This is struck-through text using the s tag.

This is deleted text using the del tag.

Try it yourself

Superscript and Subscript: <sup> and <sub>

  • <sup>: Displays text as superscript (above the baseline).
  • <sub>: Displays text as subscript (below the baseline).
Example

Water is represented as H2O.

E=mc2

Try it yourself

Preformatted Text: <pre>

  • <pre>: Displays text with preserved formatting, including spaces and line breaks.
Example
This is preformatted text.
It maintains spaces and
line breaks as they are.
Try it yourself

Small Text: <small>

  • <small>: Displays text in a smaller size.
Example

This is normal text and this is smaller text.

Try it yourself

Mark Text: <mark>

  • <mark>: Highlight or emphasize text by marking it with a visual cue, such as a background color
Example

To learn more about HTML, you should focus on the basic structure of a webpage.

Try it yourself

Modern Approach: Using CSS for Styling

While HTML formatting tags provide basic text styling, modern web development practices recommend using CSS for styling. CSS offers greater flexibility and control over the appearance of text and other elements.

Example

This text is bold using CSS.

This text is italicized using CSS.

This text is underlined using CSS.

This text is struck-through using CSS.

Water is represented as H2O.

E=mc2

Try it yourself