How to Choose the Correct HTML Tag to Make a Text Italic?
How to Choose the Correct HTML Tag to Make a Text Italic?
In HTML, we have two tags to make a text italicized, which are:
- <em>..</em> tag
- <i>..</i> tag
Now the question arises which one to use when and what's the main difference between the two? Let us see them in more detail to understand the main difference.
1. <em>..</em> tag
The full form of em in the <em> tag is emphasize. This tag is used to make a text italic when we want to emphasize the meaning of that text.
Example:
Code:
Ouput:
He is the *most* intelligent boy in the class.
2. <i>..</i> tag
This tag is also used to make a text italic but not with the intention of emphasizing it. It is generally used when we want some specific data or a specific word to appear differently than other words to convey its importance.
Example:
Code:
Ouput:
So what's the difference? In terms of text appearance, both of them are the same but the main difference is that both of them convey a different meaning. Let us see some examples for a clear understanding.
Example 1: Making Text Italic Using HTML … Tag
Example
Code:
Output:
Example 2: Making Text Italic Using HTML <i>…</i> tag
Example:
Output:
Example 3: Using Both HTML Tags Simultaneously
Example:
Output:
Example 4: Making Text Italic Using CSS font-style Property
We can also use the CSS font-style property to make the text italic.
Example:
Output:
Learn more
If you want to learn more about the HTML tags, click here.
If you want to learn more about the CSS font properties, click here
Browser Support
Both of these HTML tags are supported by almost all the browsers out there.
Conclusion
- In HTML, we have two tags to make the text italic.
- The <em> tag is used to make a text italic when we want to emphasize the meaning of that text.
- The <i> tag is generally used when we want some specific data or a specific word to appear differently than other words to convey its importance.
- Technically, both of these tags have the same italic effect on the specified text.