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:
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.
<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.
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.
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With