Description:
The HTML i tag makes its content rendered in italic font style. The <i> tag defines a part of text in an alternate voice or mood. The content of the <i> tag is usually displayed in italic. The presentational nature of this element makes it a good candidate for deprecation in future versions of HTML, so the general recomendation is to stop using it.
Good replacements for this element are: the "font-style" property in CSS (only visual) and the HTML em element, which gives its content emphasis and is usually rendered by browsers in italic font style.
Note, that there's a big difference between these two methods: the first one doesn't provide semantic information.
Note:
Use the <i> element only when there is not a more appropriate semantic element, such as:
- <em> (emphasized text)
- <strong> (important text)
- <mark> (marked/highlighted text)
- <cite> (the title of a work)
- <dfn> (a definition term)
Differences Between HTML 4.01 and HTML5:
In HTML 4.01, the <i> tag was used to render text in italics. However, this is not necessarily the case with HTML5. Style sheets can be used to format the text inside the <i> element.
Examples:
Code | View |
---|---|
A piece in this text is rendered in <i>italic font style</i>. | A piece in this text is rendered in italic font style. |
Standard Attributes for this element:
Attribute |
Description |
---|---|
class | Document wide identifier |
dir | Specifies the direction of the text |
id | Document wide identifier |
title | Specifies a title to associate with the element. |
style | Helps to include inline casecadubf style sheet. |
lang | Sets the language code. |
Event Attributes:
Attribute |
Description |
---|---|
onclick | Script runs when a mouse click |
ondblclick | Script runs when a mouse double-click |
onmousedown | Script runs when mouse button is pressed |
onmouseup | Script runs when mouse button is released |
onmouseover | Script runs when mouse pointer moves over an element |
onmousemove | Script runs when mouse pointer moves |
onmouseout | Script runs when mouse pointer moves out of an element |
onkeypress | Script runs when key is pressed and released |
onkeydown | Script runs when key is pressed |
onkeyup | Script runs when key is released |
The post HTML i tag appeared first on .