HTML <i> Tag โ Italic Text (Visual Only)
๐ Introduction
The <i> tag is used to display text in italic style in HTML.
However, unlike <em>, it does not add meaning or emphasis. It is only used for visual formatting.
๐งฑ Syntax
<i>Italic text here</i>
๐ก Example
<!DOCTYPE html>
<html>
<head>
<title>I Tag Example</title>
</head>
<body>
<p>This is normal text.</p>
<p>This is <i>italic text</i> using the i tag.</p>
</body>
</html>
๐ฅ๏ธ Output Explanation
- Normal text appears regular
- Text inside
<i>appears italic - It has no semantic meaning, only style
๐ฏ When to Use <i>
Use <i> for:
- Foreign words
- Technical terms
- Names of books, movies, or ships
- Styling without importance
Example:
<p>I love the movie <i>Inception</i>.</p>
โ๏ธ <i> vs <em>
| Tag | Meaning | Use |
|---|---|---|
<i> |
Italic (visual only) | Styling |
<em> |
Emphasis (semantic) | Meaning + importance |
Example:
<p>I am <i>happy</i>.</p>
<p>I am <em>happy</em>.</p>
โ <i> = just looks italic
โ <em> = stressed meaning
โ ๏ธ Important Note
Modern HTML suggests:
๐ Use <em> when meaning matters
๐ Use <i> only for styling or special text types
๐ซ Common Mistakes
- Using
<i>for emphasis โ - Replacing
<em>with<i>โ - Using it for normal paragraph styling โ
๐จ Styling <i>
You can customize it:
<i style="color: gray;">Technical term</i>
๐งช Mini Exercise
Create a page with:
- A paragraph about your favorite movie
- Use
<i>for:- Movie name
- Any foreign words or titles