HTML Text Formatting

Formatting is used for better look and feel. HTML provides the ability of formatting text just like you do it in MS Word or any text editing software. HTML provides us ability to format text without using CSS.

<b> Tag

The HTML <b> element defines bold text, without any extra importance.

<strong> Tag

The HTML <strong> element defines text with strong importance.

The content inside <strong>…. <strong> element is typically displayed in bold.

<i> Tag

The content inside <i>….. </i> element is typically displayed in italic.

The <i> tag is often used to indicate a technical term, a phrase from another language, a thought, etc.

<em> Tag

The HTML <em> element defines emphasized text. A screen reader will pronounce the words in <em> with an emphasis, using verbal stress.

The content inside <em>….</em> is typically displayed in italic.

<mark> Tag

If you want to mark or highlight a text, you should write the content within <mark>………</mark> element.

<u> Tag

If you want underlined text write anything within <u>………</u> element.

<strike> Tag

Anything written within <strike>…………………..</strike> element is displayed with strikethrough. It is a thin line which cross the statement.

<tt> Tag

It is used for Monospaced Font. Monospaced font provides similar space among every letter. In a monospaced font, each letter has the same width.

<sup> Tag

If you put the content within <sup>…………..</sup> element, is shown in superscript; means it is displayed half a character’s height above the other characters.

Superscript text can be used for footnotes, like WWW[1].

<sub> Tag

If you put the content within <sub>…………..</sub> element, is shown in subscript ; means it is displayed half a character’s height below the other characters.

Subscript text can be used for chemical formulas, like H2O

<del> Tag

Anything written within <del>……….</del> element is displayed as deleted text.

The HTML <del> element defines text that has been deleted from a document.

Browsers will usually strike a line through deleted text.

<ins> Tag

Anything written within <ins>……….</ins> element is displayed as inserted text.

The HTML <ins> element defines a text that has been inserted into a document.

Browsers will usually underline inserted text.

<big> Tag

The HTML <big> element defines larger text.

<small> Tag

The HTML <small> element defines smaller text.

HTML Text Formatting Example

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Text Formatting Example</title>
</head>

<body>
    <p><b>This text is bold.</b></p>
    <p><strong>This text is important!</strong></p>

    <p><i>This text is italic.</i></p>
    <p><em>This text is emphasized.</em></p>

    <p><small>This is some smaller text.</small></p>
    <p><big>This is some larger text.</big></p>

    <p><mark>This is some marked text.</mark></p>

    <p><strike>This is some striked text.</strike></p>

    <p><tt>This is some Monospaced text.</tt></p>

    <p>This is <sup>sup</sup> text.</p>
    <p>This is <sub>sub</sub> text.</p>

    <p>This is <del>del</del> text.</p>
    <p>This is <ins>ins</ins> text.</p>
</body>

</html>
HTML Text Formatting Example