10

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??

Xavier_Ex
  • 8,432
  • 11
  • 39
  • 55
  • 1
    What about [going to the source](http://www.w3.org/TR/html-markup/i.html#i)? – Jon Feb 11 '13 at 15:50
  • 1
    Thank everyone for answering, as you notified I realize that there is already another question for this and it has been answered. So I'll just go ahead and read that. The result I am looking for is really a good way to represent icons, since a lot of big names are using the tag out side of the spec it creates confusion. – Xavier_Ex Feb 11 '13 at 16:04

4 Answers4

5

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).

BenM
  • 52,573
  • 26
  • 113
  • 168
  • During recent studies I also learn that using for icons is a bad idea. HTML should contain less non-semantic contents and icons being part of it. Should use css pseudo elements to display icons whenever possible. – Xavier_Ex Apr 15 '13 at 21:24
2
<i>  was the old way to make text italic in HTML.  

The tag has now been redefined in HTML5 and I believe TwitterBootstrap just used this convention for icons but it is definitely not a standard way to do icons.

http://w3.org/International/questions/qa-b-and-i-tags

Darren
  • 68,902
  • 24
  • 138
  • 144
  • 4
    Which specification deprecated the i element? – Quentin Feb 11 '13 at 15:53
  • http://www.w3.org/International/questions/qa-b-and-i-tags - while it doesn't explicity state deprecated I believe the tags should not be used for italic, especially since the HTML 5 specification has redefined the meaning of – Darren Feb 11 '13 at 15:57
2

Because HTML has become perverted over the ages.

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

SBoss
  • 8,845
  • 7
  • 28
  • 44
1

The <i> tag is discouraged, because it provides no semantic indication about why the text is italic.

To display italic text, the <em> tag should be used. (or a different tag with appropriate semantic meaning, combined with CSS)

More recently, people have started using <i> tags for icons, because i stands for icon.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964