HTML Formatting

HTML formatting involves using various tags to enhance the look and feel of text without relying on CSS. These tags allow you to make text bold, italicized, underlined, and more. HTML provides around 14 formatting options to control how text appears in both HTML and XHTML.

List of HTML Formatting Tags

Below is a list of essential HTML formatting tags and their uses:

» <b>: Makes text bold.

» <strong>: Semantically emphasizes text as important, usually rendered as bold.

» <i>: Makes text italic.

» <em>: Emphasizes text semantically, usually rendered as italic.

» <u>: Underlines text.

» <ins>: Indicates inserted text, usually rendered with an underline.

» <del>: Indicates deleted text, usually rendered with a strikethrough.

» <mark>: Highlights text.

» <big>: Makes text larger (deprecated in HTML5 but still used).

» <small>: Makes text smaller.

» <sup>: Superscript text.

» <sub>: Subscript text.

» <br>: Inserts a line break.

» <hr>: Inserts a horizontal rule (line).

<!DOCTYPE html>
<html>
<head>
<title>HTML Formatting Example</title>
</head>
<body>
<p>This is bold text.</p>
<p>This is strong (semantic bold) text.</p>
<p>This is italic text.</p>
<p>This is emphasized (semantic italic) text.</p>
<p>This is underlined text.</p>
<p>This is inserted text.</p>
<p>This is deleted text.</p>
<p>This is highlighted text.</p>
<p>This is big text.</p>
<p>This is small text.</p>
<p>This is superscript text.</p>
<p>This is subscript text.</p>
<p>This is a line break:
after break.</p>
<p>This is a horizontal rule.</p>
</body>
</html>

Explanation:

Bold and Strong:

<b>: Makes text bold without adding any extra semantic importance.

<strong>: Adds semantic importance to the text, usually rendered as bold.

Italic and Emphasized:

<i>: Makes text italic without adding any extra semantic importance.

<em>: Adds semantic emphasis to the text, usually rendered as italic.

Underline, Insert, and Delete:

<u>: Underlines text.

<ins>: Indicates inserted text, often rendered with an underline.

<del>: Indicates deleted text, often rendered with a strikethrough

Highlight, Big, and Small:

<mark>: Highlights text.

<big>: Makes text larger.

<small>: Makes text smaller.

Superscript and Subscript:

<sup>: Superscript text (e.g., for exponents).

<sub>: Subscript text (e.g., for chemical formulas).

Line Break and Horizontal Rule:

<br>: Inserts a line break.

<hr>: Inserts a horizontal rule (line).

These formatting tags help control the presentation and meaning of text on web pages, providing both visual and semantic enhancements.