Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the proper use case for html <i> element? [duplicate]

Tags:

html

icons

italic

At first this question seem simple, from all the real life examples I have seen, is used for displaying icons. For example the twitter bootstrap icons.

However, when I search tag in google, the w3c school says is for italic text.

I am confused, if is used for italic text, why is everyone using it for icons? What is the proper use of this tag??

like image 724
Xavier_Ex Avatar asked Feb 11 '13 15:02

Xavier_Ex


People also ask

Can HTML id be duplicated?

The ID attribute uniquely identifies elements on a page. It does not make sense to duplicate an ID.

Can 2 HTML elements have the same ID?

The HTML id attribute is used to specify a unique id for an HTML element. You cannot have more than one element with the same id in an HTML document.

What happens if multiple elements have same ID?

As HTML and CSS are designed to be very fault tolerant, most browsers will in fact apply the specified styles to all elements given the same id. However, this is considered bad practice as it defies the W3C spec. Applying the same id to multiple elements is invalid HTML and should be avoided.

Can multiple elements have same class and id?

Classes are not uniqueYou can use the same class on multiple elements. You can use multiple classes on the same element.


2 Answers

It should be used to make text styled italic. Most semantic uses for italic text are <em>, as it is supported by screen-readers for emphasis.

<i> and <b> are slowly going out of fashion in favour of using CSS to style text, and preserving <em> and <strong> for accessibility reasons.

I guess that it was selected for icons since it is the closest element and makes alphabetic sense (i.e. i = icon).

like image 115
BenM Avatar answered Oct 26 '22 11:10

BenM


Because HTML has become perverted over the ages.

Official "proper use" in HTML 4.01 is for italic text.

like image 20
SBoss Avatar answered Oct 26 '22 09:10

SBoss