Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Welcome to Chapter 3: Text Formatting! 🎨
Think about how you prepare your School Notebook before an exam:
In HTML, we have dedicated Text Formatting Tags that allow you to do all of these things on your webpage without writing any CSS!
<b> vs <strong>Both of these tags make text appear bold and thick, but they have different purposes:
<b> (Bold): Makes the text bold purely for visual style. It does not carry any special extra importance.<strong> (Strong Importance): Tells the web browser, Google search, and Screen Readers (used by visually impaired people) that this text is critically important. Screen readers will pronounce <strong> words with a serious, emphasized tone!<strong>. If it is just for visual styling, use <b>.<i> vs <em>Both tags tilt the text into italics, but just like bold tags, they carry different meanings:
<i> (Italic): Tilts the text sideways. Used for technical terms, foreign language words, scientific names, or thought phrases.<em> (Emphasized): Adds verbal stress and emotion to a word. When reading aloud, a screen reader will emphasize the word "love" with voice inflection.<mark> (The Yellow Highlighter Pen! 🖍️)Remember using a fluorescent yellow marker on your school textbook? The <mark> tag does the exact same thing in HTML!
It wraps text with a bright, noticeable yellow highlight background:
Where is this used?
<del> and <ins>These two tags are commonly used together on E-commerce shopping websites (like Amazon or Flipkart) to show product price discounts:
<del> (Deleted): Draws a strike-through line directly across the text (e.g., <ins> (Inserted): Displays the new replacement text with an underline (e.g., <u>₹999</u>).<small>The <small> tag makes text one size smaller than the surrounding normal paragraph text:
Where is this used?
<sub> 🧪Have you ever wondered how to write science formulas like H₂O or CO₂ in HTML?
In chemistry, the small number is placed slightly below the normal text line. This is called a Subscript, and we use the <sub> tag:
<sup> 📐In mathematics, powers and exponents (like x² + y²) or ordinal dates (like 10th August) are written slightly above the normal text line. This is called a Superscript, and we use the <sup> tag:
<sub> and <sup>:
- sub = Submarine (goes down deep under the sea!) 🌊 ➔ <sub> is down below.
- sup = Superman (flies up high in the sky!) 🦸 ➔ <sup> is up above.<u>The <u> tag puts a solid line directly underneath text:
⚠️ Warning for Beginners: On the internet, users expect underlined text to be a clickable link. If you underline normal text, users will keep clicking on it thinking it is a link! Use <u> sparingly.
| Tag | Tag Name | What It Does | Real-Life School Example |
|---|---|---|---|
<b> | Bold | Visually thick text | <b>Important</b> |
<strong> | Strong | High importance / warning alert | <strong>Danger!</strong> |
<i> | Italic | Visually tilted text | <i>Homo sapiens</i> |
<em> | Emphasized | Verbal stress & emotion | <em>I told you!</em> |
<mark> | Mark | Yellow highlighter background | <mark>Correct Answer</mark> |
<small> | Small | Smaller fine print / copyright | <small>© 2026 MSK</small> |
<del> | Delete | Strikethrough line across text | <del>₹999</del> |
<ins> | Insert | Underlines newly added text | <ins>₹499</ins> |
<sub> | Subscript | Lowers text below the baseline | H<sub>2</sub>O (Water) |
<sup> | Superscript | Raises text above the baseline | x<sup>2</sup> or 10<sup>th</sup> |
<u> | Underline | Puts a line under the text | <u>Read this</u> |
<sub> and <sup>:H<sub>2</sub>O), Superman flies up (x<sup>2</sup>).<strong> for critical alerts and <b> for simple bold styling.<em> for spoken emphasis and <i> for italic terms.<mark> to highlight words with a bright yellow background.<del> and <ins> for showing old vs new discounted prices.<sub> for Chemistry formulas (like H₂O).<sup> for Math powers (like x²) and ordinals (like 10th).Test your understanding with these multiple-choice questions:
<strong> and <b>?index.html file in VS Code.<body>, create a Science & Math Study Sheet:Photosynthesis converts 6CO<sub>2</sub> + 6H<sub>2</sub>O into glucose.Pythagoras Theorem: a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup>.Book Price: <del>₹500</del> <ins>₹299</ins> only!<mark>Special Offer</mark>.Ctrl + S) and view your clean, formatted study sheet live in your browser! 🚀In the next lesson, we will continue your web development journey with Quotations & Citations (Text Formatting).
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Paragraphs & Line Breaks | Quotations & Citations |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.