Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does font-awesome recommend using <i> elements instead of <span> elements? Is one preferable for a concrete reason? [duplicate]

If you review the examples for font-awesome, you will see that they consistently use the i element. I would have thought that the span element would be a more appropriate choice, since the i element was intended to modify a "span of text.", but what I want to do is place a glyph on the page, not modify existing text.

You could make the case that the span element was also intended to modify a span of text (hence the name), but the W3C definition leaves it wide open--simply stating that span "can be useful when used together with other attributes."

However, my question is not focused on the semantics of the two tags, but on the user experience implications of one tag over the other. In my testing, the span works just as well as i. Are there any concrete reasons why one is preferable over the other? Examples of concrete reasons include:

  1. One element being handled reasonably by accessibility software (e.g., screen readers), and the other not.
  2. User agent support (e.g., one element behaves consistently across user agents, the other doesn't).
like image 207
Josh Avatar asked Feb 04 '14 17:02

Josh


People also ask

Why We Use Font Awesome icons instead of images?

Designers love the use of icons as fonts because of the flexibility of styling available. Plus, using a font will also render icons as sharp as your device will allow, so there's no need to worry about creating retina graphics since Font Awesome will give you high-quality iconography on every device.

Should I use SPAN or I for icons?

<i> isn't the icon tag, it's the italic tag, and it doesn't make much difference which you pick. <span> is more semantically correct, because it has no semantics.

Why do we use Font Awesome?

Font Awesome is a widely-used icon set that gives you scalable vector images that can be customized with CSS. With over 1,600 icons in the free set, you should be able to find an icon to suit your needs.

Why is I element used for icons?

The I element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, a ship name, or some other prose whose typical typographic presentation is italicized.


1 Answers

I've never experienced a difference in user experience between the i element or a span with a css style that makes the text italics. The reason why you might want to prefer the span element is just semantic (separation of content and style).

like image 93
Blue Box Avatar answered Oct 11 '22 14:10

Blue Box