大网数据广告活动
网站运营与故障问答

Is it bad practice for SEO to use <i> in header elements?

· 52CE 我爱测

For making a user friendly website, I have to use some of Font Awesome fonts in <h> elements like this: <h2> <i style="color: rgb(102, 149, 45); vertical-align: inherit;" class="fa fa-gear"></i> Performance </h2> In fact, this is…

问题原文

原帖链接 · Amirreza Nasiri · CC BY-SA 3.0

For making a user friendly website, I have to use some of Font Awesome fonts in <h> elements like this:

<h2>
<i style="color: rgb(102, 149, 45); vertical-align: inherit;" class="fa fa-gear"></i>
 Performance
</h2>

In fact, this is a review article. Is it OK to put these fonts (or <i> elements) in the inner HTML of header elements like <h1>, <h2>, <h3>, etc.?

Please provide your source or some documentation, too, because it's really important for me; I don't want to make any mistakes about this topic.

已采纳解答

原帖链接 · Martijn · CC BY-SA 3.0

I would say it wouldn't harm much, nor will it add anything. I prefer to keep my header tags clean and wouldn't add the i. The inline styling would be a bigger problem, which isn't really an big issue.

Instead of doing this, you can add the gear icon to the H2 directly:

h2.Geared:before{
    display: inline-block;
    color: rgb(102, 149, 45); 
    font-family: "FontAwesome";
    content: "\f013"; /*The actual character FontAwesome uses */
}

<h2 class="Geared">This text will have the gear</h2>

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。