Updates
  • Starting New Weekday Batch for Full Stack Java Development on 27 September 2025 @ 03:00 PM to 06:00 PM
  • Starting New Weekday Batch for MERN Stack Development on 29 September 2025 @ 04:00 PM to 06:00 PM
Join Course

Text Formatting

• Text formatting in HTML involves modifying the appearance of text to enhance readability and visual appeal.
• HTML provides various tags and attributes to apply text formatting, such as changing the font, size, color, and style (bold, italic, underline).
• The <b> tag is used to make text bold, while the <i> tag is used to italicize text.
• The <u> tag is used to underline text, and the <s> or <strike> tags are used to apply a strikethrough effect.

Basic Text Formatting

Bold Text

• In HTML, you can create bold text by using the <b> tag and strong text by using the <strong> tag.
• The <b> tag is used for stylistic purposes to apply a bold formatting style to the enclosed text.
• Similarly, the <strong> tag is used for semantic emphasis, indicating that the enclosed text is of strong importance.
• To make specific text bold, wrap it within the opening and closing <b> tags, like <b>Your text here</b>.
• To give strong emphasis to text, use the <strong> tags, like <strong>Your text here</strong>.
• It's important to note that the <b> tag should be used for stylistic purposes only and not for semantic markup. For semantic emphasis, it is recommended to use the <strong> tag instead.

            
<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1>Bold Text</h1>
    <p>Welcome to <b>JTC</b></p>
    <p>Hello <strong>Everyone</strong></p>
</body>
</html>
        

Italic Text

• In HTML, the <i> tag is used to apply italic styling to text, while the <em> tag is used to indicate emphasized or important text.
• The <i> tag is primarily used for presentational purposes to apply an italic style to the enclosed text.
• On the other hand, the <em> tag is used for semantic emphasis, indicating that the enclosed text has strong importance or emphasis.
• To make specific text italic, wrap it within the opening and closing <i> tags, like <i>Your text here</i>.
• To give semantic emphasis to text, use the <em> tags, like <em>Your text here</em>.
• It's important to note that the <i> tag should be used for stylistic purposes only and not for semantic markup. For semantic emphasis, it is recommended to use the <em> tag instead.

            
<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1>Italic Text</h1>
    <p>Welcome to <i>JTC</i></p>
    <p>Hello <em>Everyone</em></p>
</body>
</html>
        

Underline text

• In HTML, you can underline text by using the <u> tag.
• The <u> tag stands for "underline" and is used to apply an underline formatting style to the enclosed text.
• To make specific text underlined, simply wrap it within the opening and closing <u> tags, like <u>Your text here</u>.
• When the webpage is rendered, the text enclosed within the <u> tags will appear underlined in the browser.
• It's important to note that underlining text is generally discouraged in modern web design, as it can be confused with hyperlinks. Instead, it is recommended to use CSS to style text with alternatives such as color, font, or background changes.

            
<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1>Underline Text</h1>
    <p>Welcome to <u>JTC</u></p>
</body>
</html>
        

Strike text

• In HTML, the <s>, <del>, and <strike> tags are used to apply a strikethrough effect to text.
• The <s> tag is the standard tag for strikethrough, while the <del> and <strike> tags are considered deprecated but still supported.
• To make specific text appear struck through, wrap it within the opening and closing tags, like <s>Your text here</s>, <del>Your text here</del>, or <strike>Your text here</strike>.
• When the webpage is rendered, the text enclosed within these tags will appear with a line through it in the browser.
• These tags are often used to indicate deleted or no longer relevant content, or for stylistic purposes to create a crossed-out effect.

            
<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1>Welcome to JTC</h1>
    <p>Hello <s>Everyone</s></p>
</body>
</html>
        

Superscript Text

• In HTML, you can create superscript text by using the <sup> tag.
• The <sup> tag stands for "superscript" and is used to raise the enclosed text above the normal baseline.
• To make specific text appear as superscript, simply wrap it within the opening and closing <sup> tags, like <sup>Your text here</sup>.
• When the webpage is rendered, the text enclosed within the <sup> tags will appear smaller and higher than the surrounding text.
• Superscript text is commonly used for indicating footnotes, mathematical exponents, or references.

            
<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1>Welcome to <sup> JTC</sup></h1>
</body>
</html>
        

Subscript Text

• In HTML, you can create subscript text by using the <sub> tag.
• The <sub> tag stands for "subscript" and is used to lower the enclosed text below the normal baseline.
• To make specific text appear as subscript, simply wrap it within the opening and closing <sub> tags, like <sub>Your text here</sub>.
• When the webpage is rendered, the text enclosed within the <sub> tags will appear smaller and lower than the surrounding text.
• Subscript text is commonly used for chemical formulas, mathematical notations, or displaying footnotes.

            
<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1>Welcome to <sub> JTC</sub></h1>
</body>
</html>
        

Larger Text

• In HTML, you can create larger text by using the <big> tag.
• The <big> tag is used to increase the size of the enclosed text relative to the surrounding text.
• To make specific text appear larger, simply wrap it within the opening and closing <big> tags, like <big>Your text here</big>.
• When the webpage is rendered, the text enclosed within the <big> tags will appear larger than the surrounding text.
• It's important to note that the <big> tag is considered deprecated and is no longer recommended. Instead, it's better to use CSS (Cascading Style Sheets) to control the size of text elements.

            
<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1>Larger text</h1>
    <p>Welcome To <big>JTC</big></p>
</body>
</html>
        

Small Text

• In HTML, you can create smaller text by using the <small> tag.
• The <small> tag is used to decrease the size of the enclosed text relative to the surrounding text.
• To make specific text appear smaller, simply wrap it within the opening and closing <small> tags, like <small>Your text here</small>.
• When the webpage is rendered, the text enclosed within the <small> tags will appear smaller than the surrounding text.
• It's important to note that the <small> tag is primarily used for stylistic purposes. For semantic markup, it is recommended to use appropriate tags like <sub> for subscript or CSS (Cascading Style Sheets) to control the size of text elements.

            
<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <h1>Smaller text</h1>
    <p>Welcome To <small>JTC</small></p>
</body>
</html>