How To Formatting Text HTML

HTML text formatting allows you to apply various styles to text on a web page. The way how to formatting text HTML is that making text on HTML to Bold, Italic, Underline ,Emphasized, strong, Marked text and so on.

Click here to watch on Youtube.

Let see How To Formatting Text HTML below:

HTML Formatting Elements

    <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

The example below demonstrates how each tag is used to format text in HTML.

Bold Text: <b> OR Important text <strong>

It uses to make make the text bold.

<b>This text is bold</b>
<strong>This text is strong</strong>

Italic Text: <i> : is use to make Italicizes the text.

<i>Italic text</i>

Emphasized Text: <em> : italicizes the text and shows emphasis.

<em>Emphasized text</em>

Marked Text: <mark> : Highlights the text as marked or highlighted.

<mark>Marked text</mark>

Smaller Text: <small> : making smaller the font size of the text.

<small>Smaller text</small>

Deleted Text: <del> : shows the text as deleted or struck through.

<del>Deleted text</del>

Inserted Text: <ins> : Indicates inserted text with an underline.

<ins>Inserted text</ins>

Subscript Text: <sub> : Displays the text as subscript, which is lower and smaller.

H<sub>2</sub>O

Superscript Text: <sup> : Displays the text as superscript, which is higher and smaller.

a<sup>2</sup>+ b<sub>2</sub> = 0

Example for all Text Format HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Text Formatting Example</title>
</head>
<body>
    <p><b>Bold text</b></p>
    <p><strong>Important text</strong></p>
    <p><i>Italic text</i></p>
    <p><em>Emphasized text</em></p>
    <p><mark>Marked text</mark></p>
    <p><small>Smaller text</small></p>
    <p><del>Deleted text</del></p>
    <p><ins>Inserted text</ins></p>
    <p>CO<sub>2</sub></p>
    <p>a<sup>2</sup>+ b<sub>2</sub> = 0</p>
</body>
</html>

Output:

How To Formatting Text HTML
How to format text in HTML

freecode4learn.com

Leave a Reply