Formatting
In HTML, formatting is all about giving your text some personality. Whether you want to highlight something important, make text bold, or even show deleted or added content, HTML has simple tags for all these needs.
Why Use Text Formatting ?
Imagine writing a blog post, a note or even an instruction manual. Sometimes you want your readers to focus on something specific or just make it look nice and readable. That is where formatting helps.
You can make text
Syntax:
Example:
Output:

Tips
Why Use Text Formatting ?
Imagine writing a blog post, a note or even an instruction manual. Sometimes you want your readers to focus on something specific or just make it look nice and readable. That is where formatting helps.
You can make text
- Bold
- Italic
- Highlighted
- Small
- Subscript / Superscript etc.
Tag | Purpose |
---|---|
<b> | Bold text (Just make text bold) |
<strong> | Strong importance (Screen readers read it with emphasis) |
<i> | <Italic text> |
<em> | Emphasized text (like italics, but more meaningful) |
<mark> | Marked or highlighted text |
<small> | Makes the text smaller |
<del> | Shows deleted / struck text |
<ins> | Shows inserted (newly added) text |
<sub> | Subscript (Ex - Chemical formulas) |
<sup> | Superscript (Ex - Math equations) |
Syntax:
<b>This is bold</b> <i>This is italic</i> <mark>This is highlighted</mark>
Example:
<!DOCTYPE html> <html> <head> <title>Formatting Example</title> </head> <body> <p><b>This is bold text</b></p> <p><strong>This is important text</strong></p> <p><i>This is italic text</i></p> <p><em>This is emphasized text</em></p> <p><mark>This text is highlighted</mark></p> <p><small>This is smaller text</small></p> <p><del>This text is deleted</del></p> <p><ins>This text is newly inserted</ins></p> <p>H<sub>2</sub>O (This is subscript)</p> <p>2<sup>4</sup> = 16 (This is superscript)</p> </body> </html>
Output:

Tips
- Use <strong> and <em> when meaning matters (for SEO and screen readers).
- Do not overuse formatting it should guide the reader, not distract them.
- Combine formatting for cool effect like