Write a program to demonstrate an HTML text formatting tags.

1
2
3
    <html>
4
    <head>
5
    <title> text style </title>
6
    </head>
7
8
    <body>
9
10
    <p>How to use <i>Italic tag.</i></p>
11
12
    <p>How to use <b>Bold tag.</b></p>
13
    <p>How to use <u>Underline tag</u>.</p>
14
    <p>How to use <s>Strick tag</s>.</p>
15
    <p>How to use superscript tag like 2<sup> 2 </sup> is 4.</p>
16
    <p>How to use subscript tag like H<sub>2 </sub>O.</p>
17
18
19
    </body>
20
    </html>
21
22
    

Output

1
2
        No Output Available
3
        

Rate the Code

Reviews are published after a quick safety check (usually within 24 hours).

Reviews are public. Developers can see basic device specifications to respond. Learn more

Core Concept of HTML Text Formatting Tags

To represent special text/word or letters, text formatting tags are used.

There are a lot of tags that exist for text formatting.

  • <i> Italic : To slant the text.
  • <b> Bold: To show the text with some darkness.
  • <u> Underline : To draw a straight line under the text.
  • <s>Strikethrough : To draw a straight line through the middle of the text to ignore the text.
  • <sup>Superscript : To represent mathematical powers like 22 , etc.
  • <sub>Subscript : To represent the text below the normal text, like H2O.

Why is it used?

  • To represent mathematical formulas or prices.
  • To improve the text readability and visibility.

Real-Life Applications

  • E-Commerce Website: To show the new price with the old strike price for a sale, discount, or new offer. The strikethrough is used.
  • Educational & Science Blogs: To show science or math formulas like H2O, CO2, x2+y2, etc. the superscript is used
  • Articles and Books: To represent the book name or foreign word, the italic <i> tag or element is used. Right now, you are reading this content is the best real-life example of text formatting.

Key Benefits of this Program

  • No need to add CSS styles; clean formatting is applied, and it will improve the text readability.
License: This program's source code is open-sourced under the MIT License, while the rest of the program's text content and overall dhimanp platform and brand content remain proprietary under dhimanp.

Submit your modified code

Your submissions are published after a quick safety check (usually within 7 days).

Submissions are public. Developers can see basic device specifications to respond. Learn more

Disclaimer

The information that you shared with us will be publicly visible, and everyone can see your information. And we (dhimanp) are not responsible if anyone misuses this information. We can remove any submitted code at any time for better transparency.

Privacy Policy

If you share your data with us by submitting your code for credit, then we may show your full name, school or college name, and city name on our website.

We are not using this data to track you and are not selling this data to anyone.

If you want to remove your name from our website, you can contact us, and we will remove your name from our website. In the removal process, full credit, including your full name, school or college, city, and code, will be removed from our website.