Formatting Text in HTM

Code Bacha
0
Formatting Text in HTML - codeBacha

Formatting Text in HTML

In this lesson, we’ll explore HTML tags used to format text. These tags include <b>, <i>, <u>, <br>, and <hr>.

1. <b>: Bold Text

The <b> tag is used to make text bold. Example:

        <p>This is <b>bold</b> text.</p>
    

Output: This is bold text.

2. <i>: Italic Text

The <i> tag is used to italicize text. Example:

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

Output: This is italic text.

3. <u>: Underlined Text

The <u> tag is used to underline text. Example:

        <p>This is <u>underlined</u> text.</p>
    

Output: This is underlined text.

4. <br>: Line Break

The <br> tag is used to insert a line break, allowing content to move to the next line. Example:

        <p>This is line one.<br>This is line two.</p>
    

Output:

This is line one.
This is line two.

5. <hr>: Horizontal Rule

The <hr> tag creates a horizontal line, which is often used to separate sections. Example:

        <p>Text above the line.</p>
        <hr>
        <p>Text below the line.</p>
    

Output:

Text above the line.


Text below the line.

Practical Example

Here’s a practical example combining these tags:

        <p>This is <b>bold</b>, <i>italic</i>, and <u>underlined</u> text.</p>
        <p>Line one.<br>Line two.</p>
        <hr>
        <p>End of the section.</p>
    

Output:

This is bold, italic, and underlined text.

Line one.
Line two.


End of the section.

Written By: Muhammad Shoaib Khan Marwat (MSKM) | https://codebacha.blogspot.com/
Tags

Post a Comment

0Comments

Post a Comment (0)