我应该使用< i>标记图标而不是< span&gt ;? [英] Should I use <i> tag for icons instead of <span>?

查看:277
本文介绍了我应该使用< i>标记图标而不是< span&gt ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了Facebook的来源,他们使用< i> 标签显示图标。



另外,今天我看了一下Twitter的Bootstrap。它还使用< i> 标签显示图标。



但是,

来自 HTML5规范


I元素表示以替代语音或情绪
或以其他方式偏离正常散文的文本范围,例如分类学
指定,技术术语,来自另一
语言的惯用语,思想,船名或某些其他散文,其典型
印刷介绍以斜体表示。

为什么他们使用< i> 标签显示图标?

这不是一个坏习惯吗?



或者我在这里丢失了什么?



我正在使用 span

更新:


显示图标,它似乎对我至今仍然有用。

Bootstrap 3现在使用 span 作为图标。 官方文档

解决方案


为什么他们使用< i> 标签显示图标?




因为它是:



  • 我代表图标(尽管不是HTML)




这不是一个坏习惯吗?


可怕的做法。这是性能胜过语义的胜利。


I've looked into the source of Facebook, they use the <i> tag to display icons.

Also, today I looked into Twitter's Bootstrap. It also uses <i> tag to display icons.

But,

From the HTML5 spec:

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.

Why are they using <i> tag to display icons?

Is it not a bad practice?

Or am I missing something here?

I am using span to display icons and it seems to be working for me till now.

Update:

Bootstrap 3 now uses span for icons. Official Doc

解决方案

Why are they using <i> tag to display icons ?

Because it is:

  • Short
  • i stands for icon (although not in HTML)

Is it not a bad practice ?

Awful practice. It is a triumph of performance over semantics.

这篇关于我应该使用&lt; i&gt;标记图标而不是&lt; span&gt ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆