📘 DAY 9: HTML FORMATTING TAGS
1️⃣ What are HTML Formatting Tags?
HTML Formatting Tags are used to:
Format text
Highlight important content
Improve readability
Add meaning (semantic value)
They change how text looks and sometimes what it means.
2️⃣ Basic Formatting Tags Overview
| Tag | Purpose |
|---|---|
<b> | Bold text |
<i> | Italic text |
<u> | Underline text |
<strong> | Important text |
<em> | Emphasized text |
<mark> | Highlight text |
<small> | Smaller text |
<del> | Deleted text |
<ins> | Inserted text |
<sub> | Subscript |
<sup> | Superscript |
3️⃣ <b> – Bold Text
Displays text in bold, but has no semantic importance.
👉 Use only for visual styling.
4️⃣ <strong> – Important Text
Displays text in bold, but also indicates importance.
✔ Better for SEO & accessibility
5️⃣ <i> – Italic Text
Displays text in italic, no extra meaning.
6️⃣ <em> – Emphasized Text
Displays text in italic with emphasis meaning.
✔ Screen readers stress this text
✔ Preferred over <i>
7️⃣ <u> – Underline Text
Underlines the text.
⚠️ Avoid excessive use (can look like links).
8️⃣ <mark> – Highlight Text
Highlights text with background color.
✔ Useful for notes & keywords
9️⃣ <small> – Smaller Text
Displays text in smaller font size.
🔟 <del> – Deleted Text
Shows deleted content with strike-through.
1️⃣1️⃣ <ins> – Inserted Text
Shows inserted content (usually underlined).
1️⃣2️⃣ <sub> – Subscript Text
Used for chemical formulas.
1️⃣3️⃣ <sup> – Superscript Text
Used for math expressions.
1️⃣4️⃣ Difference: <b> vs <strong>
<b> | <strong> |
|---|---|
| Visual only | Semantic meaning |
| No importance | Important content |
| Not SEO-friendly | SEO-friendly |
1️⃣5️⃣ Difference: <i> vs <em>
<i> | <em> |
|---|---|
| Visual only | Emphasis |
| No meaning | Semantic |
| Avoid for content | Recommended |
1️⃣6️⃣ Combining Formatting Tags
👉 Tags can be nested properly
1️⃣7️⃣ Common Beginner Mistakes
❌ Overusing <b> and <i>
❌ Ignoring semantic tags
❌ Incorrect nesting
❌ Using formatting instead of CSS
1️⃣8️⃣ Practice Examples
Example 1:
Example 2:
1️⃣9️⃣ Interview / Viva Questions
Difference between
<b>and<strong>?Difference between
<i>and<em>?What is
<mark>tag?Where is
<sub>used?Are formatting tags semantic?
2️⃣0️⃣ Summary
Formatting tags change text appearance
Semantic tags give meaning
Prefer
<strong>&<em>Avoid misuse of formatting
Use CSS for styling in real projects

0 comments:
Post a Comment