β¨ Lesson 1.4 β Text Formatting Tags
π¨ Making Text Attractive and Meaningful Using HTML Formatting Tags
π― Learning Objectives
After completing this lesson, students will be able to:
β Understand text formatting in HTML
β Make text bold
β Make text italic
β Underline text
β Highlight text
β Create superscript and subscript text
β Display deleted and inserted text
β Use formatting tags professionally
π Introduction
Imagine reading a book where every word looks exactly the same.
Example:
Welcome to NextGen Dev Hub. This course teaches web designing and web development.
It is readable, but important words do not stand out.
Now look at this:
Welcome to NextGen Dev Hub.
This course teaches WEB DESIGNING and WEB DEVELOPMENT.
Now important information is easier to identify.
This is called:
β¨ Text Formatting
Text formatting helps make content:
β Attractive
β Easy to Read
β Professional
β More Understandable
HTML provides several formatting tags for this purpose.
π¨ What is Text Formatting?
Text formatting means changing the appearance of text.
Examples:
- Bold Text
- Italic Text
- Underlined Text
- Highlighted Text
- Small Text
- Superscript
- Subscript
π Why Text Formatting is Important
Imagine a college website.
Without formatting:
Admission Open 2026 Last Date 30 June
With formatting:
Admission Open 2026
Last Date: 30 June
Much easier to understand.
Formatting improves communication.
π₯ Bold Text
Bold text is used to emphasize important information.
HTML Tag:
<b>
Example
<b>Welcome Students</b>
Output
Welcome Students
Real Life Example
<p>
Course Fee: <b>βΉ999</b>
</p>
Output:
Course Fee: βΉ999
π Strong Tag
HTML also provides:
<strong>
This tag also makes text bold.
Example
<strong>Important Notice</strong>
Output:
Important Notice
Difference Between b and strong
b Tag
Makes text bold.
strong Tag
Makes text bold and indicates importance.
Professional Recommendation
Use:
<strong>
for important content.
βοΈ Italic Text
Italic text is often used for:
- Quotes
- Special Terms
- Emphasis
Tag:
<i>
Example
<i>Web Designing Course</i>
Output:
Web Designing Course
π Emphasis Tag
HTML also provides:
<em>
Example
<em>Important Concept</em>
Output:
Important Concept
Difference
i
Visual Italic
em
Meaningful Emphasis
Professional Recommendation
Use:
<em>
when emphasizing content.
π Underline Text
Used to underline text.
Tag:
<u>
Example
<u>Admission Open</u>
Output:
<u>Admission Open</u>
Real Life Example
<p>
Last Date:
<u>30 June 2026</u>
</p>
ποΈ Highlighted Text
Sometimes we want to highlight important information.
HTML Tag:
<mark>
Example
<mark>Important Announcement</mark>
Output:
<mark>Important Announcement</mark>
Real Life Example
<p>
New Batch Starts On
<mark>1 July 2026</mark>
</p>
β Deleted Text
Used to show removed content.
Tag:
<del>
Example
<del>βΉ2000</del>
Output:
βΉ2000
Real Life Example
<p>
Old Price:
<del>βΉ2000</del>
New Price:
βΉ999
</p>
Output:
Old Price: βΉ2000
New Price: βΉ999
β Inserted Text
Used to indicate newly added content.
Tag:
<ins>
Example
<ins>New Offer Available</ins>
Output:
<ins>New Offer Available</ins>
π½ Subscript Text
Subscript text appears slightly below the normal line.
Tag:
<sub>
Example
Water Formula:
H<sub>2</sub>O
Output:
HβO
More Examples
CO<sub>2</sub>
Output:
COβ
H<sub>2</sub>SO<sub>4</sub>
Output:
HβSOβ
πΌ Superscript Text
Superscript text appears slightly above the normal line.
Tag:
<sup>
Example
x<sup>2</sup>
Output:
xΒ²
More Examples
10<sup>2</sup>
Output:
10Β²
a<sup>3</sup>
Output:
aΒ³
π Small Text
Used for less important information.
Tag:
<small>
Example
<small>Terms and Conditions Apply</small>
Output:
<small>Terms and Conditions Apply</small>
π» Complete Example
<!DOCTYPE html>
<html>
<head>
<title>Text Formatting</title>
</head>
<body>
<h1>Text Formatting Example</h1>
<p>
<b>Bold Text</b>
</p>
<p>
<strong>Strong Text</strong>
</p>
<p>
<i>Italic Text</i>
</p>
<p>
<em>Emphasized Text</em>
</p>
<p>
<u>Underlined Text</u>
</p>
<p>
<mark>Highlighted Text</mark>
</p>
<p>
<del>Old Price βΉ2000</del>
</p>
<p>
<ins>New Price βΉ999</ins>
</p>
<p>
H<sub>2</sub>O
</p>
<p>
x<sup>2</sup>
</p>
</body>
</html>
π― Expected Output
Displays:
β Bold Text
β Strong Text
β Italic Text
β Emphasized Text
β Underlined Text
β Highlighted Text
β Deleted Text
β Inserted Text
β HβO
β xΒ²
π« Real World Example
College Admission Notice:
<h1>Admission Notice</h1>
<p>
Admissions for <strong>2026 Session</strong> are now open.
</p>
<p>
Last Date:
<mark>30 June 2026</mark>
</p>
<p>
Old Fee:
<del>βΉ25000</del>
</p>
<p>
New Fee:
<ins>βΉ20000</ins>
</p>
This looks professional and easy to understand.
β οΈ Common Beginner Mistakes
Mistake 1
Using Too Much Formatting
Bad:
<b>
<u>
<i>
Everything
</i>
</u>
</b>
Over-formatting reduces readability.
Mistake 2
Using Bold for Entire Paragraph
Bad:
<b>
Entire paragraph here...
</b>
Use bold only for important content.
Mistake 3
Incorrect Closing Tags
Wrong:
<b>Welcome
Correct:
<b>Welcome</b>
π Best Practices
β Use Bold for important information.
β Use Italics for emphasis.
β Use Highlighting sparingly.
β Use Superscript for powers.
β Use Subscript for chemical formulas.
β Avoid excessive formatting.
π Mini Project β Student Information Card
Create:
<!DOCTYPE html>
<html>
<head>
<title>Student Information</title>
</head>
<body>
<h1>Student Profile</h1>
<p>
Name:
<strong>Rahul Kumar</strong>
</p>
<p>
Branch:
<em>Computer Science</em>
</p>
<p>
Semester:
<u>Third Semester</u>
</p>
<p>
Admission Status:
<mark>Active</mark>
</p>
<p>
Water Formula:
H<sub>2</sub>O
</p>
<p>
Math Formula:
x<sup>2</sup>
</p>
</body>
</html>
π Practical Activity
Create a webpage containing:
Your Name (Bold)
Your College (Italic)
Your Branch (Underlined)
Your Semester (Highlighted)
HβO using Subscript
xΒ² using Superscript
Run it in Chrome.
π Assignment
Assignment 1.4
Answer the following:
- What is text formatting?
- Which tag creates bold text?
- Which tag creates italic text?
- Which tag highlights text?
- What is the difference between superscript and subscript?
- Write the HTML code for HβO.
- Write the HTML code for xΒ².
π§ Quiz
Q1. Which tag creates bold text?
A. <i>
B. <b>
C. <u>
D. <p>
β Answer: B
Q2. Which tag highlights text?
A. <mark>
B. <u>
C. <strong>
D. <small>
β Answer: A
Q3. Which tag creates superscript text?
A. <sub>
B. <sup>
C. <small>
D. <mark>
β Answer: B
Q4. Which tag creates subscript text?
A. <sub>
B. <sup>
C. <ins>
D. <del>
β Answer: A
Q5. Which formula correctly displays water?
A. H2O
B. H<sup>2</sup>O
C. H<sub>2</sub>O
D. HO2
β Answer: C
π Lesson Summary
β Text formatting improves readability and presentation.
β
<b> and <strong> create bold text.
β
<i> and <em> create italic text.
β
<u> creates underlined text.
β
<mark> highlights important content.
β
<sub> creates subscript text.
β
<sup> creates superscript text.
β Proper formatting helps create professional webpages.