Search code examples
htmliconsitalic

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


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


Solution

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