HTML Text Formatting

  • Formatting in html means text-formatting.It includes making the text bold, italic, superscript, subscript etc.
  • Here are the possible formatting text options:
    • Bold Text
    • Italic Textv
    • Superscript
    • Subscript
    • Underline Text
    • Strikethrough Text
    • Deleted Text
    • Inserted Text
    • Marked Text
    • Small Text
  • Other than these, there are some other formatting text options which are known as important text. They are:
  • 1.Strong Text

    2.Emphasized Text

    3.Computer code

Bold Text



  • <b> tag is used to make the text bold.

Example: Bold Text

<!DOCTYPE html>
<html>
<body>
<p><b>This is bold</b>
</p> </body>
</html>


To see live output : Visit Try Yourself Editor

Output





Italic Text



  • <i> tag is used to make the text italic.

Example: Italic Text

<!DOCTYPE html>
<html>
<body>
<p><i>This is italic</i>.</p
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Superscript



  • <sup> tag is used to present the text as superscript.

Example: Superscript

<!DOCTYPE html>
<html>
<body>
<p>This is <sup>Superscript</sup>.</p>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Subscript



  • <sub> tag is used to present the text as subscript.

Example: Subscript

<!DOCTYPE html>
<html>
<body>
<p>This is <sub>Subscript</sub>.</p>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Underline Text



  • <u> tag is used to underline the text. This tag was deprecated in HTML 4.

Example: Underline Text

<!DOCTYPE html>
<html>
<body>
<p><u>This Text is Underlined</u>.</p>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Strikethrough Text



  • <strike> tag is used to strikethrough the text. This tag was deprecated in HTML 4.

Example: Strikethrough Text

<!DOCTYPE html>
<html>
<body>
<p><strike>This Text is Strikethrough</strike>.</p>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Deleted Text



  • <del> is used to present a text that has been deleted from the page.

Example: Deleted Text

<!DOCTYPE html>
<html>
<body>
<p><del>This Text is Deleted</del>.</p>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Inserted Text



  • <ins> is used to present a text that is inserted later in the page.

Example: Inserted Text

<!DOCTYPE html>
<html>
<body>
<p>My name is <ins>Ram</ins>.</p>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Marked Text



  • <mark> tag is uesd to mark or highlight text.

Example: Marked Text

<!DOCTYPE html>
<html>
<body>
<p>This is <mark>Marked </mark>Text.</p>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Small Text



  • <small> tag is used to define small text.

Example: Small Text

<!DOCTYPE html>
<html>
<body>
<h3>HTML <small>Small </small>Text.</h3>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output





Strong Text



  • <strong> tag is also used to make the text bold.

Example: Strong Text

<!DOCTYPE html>
<html>
<body>
<p><strong>This is strong</strong>
</p> </body>
</html>


To see live output : Visit Try Yourself Editor

Output





Emphasized Text



  • <em> tag is used to define emphasized text, with added semantic importance.
  • Example: Emphasized Text

    <!DOCTYPE html>
    <html>
    <body>
    <p>This is <em>Emphasized</em> Text.</p> </body>
    </html>


    To see live output : Visit Try Yourself Editor

    Output





    Computer Code



    • <code> tag is used to define programming code.
    • The <code> tag does not preserve extra whitespace and line-breaks:

    Example : Computer Code

    <!DOCTYPE html>
    <html>
    <body>
    <code>
    <pre>
    var student = {
    Studentname:"Ram Sharma",
    age:15,
    class:"9"
    }
    </pre>
    </code>
    </body>
    </html>


    To see live output : Visit Try Yourself Editor

    Output