就像标题所述,我正在使用.icon-*
添加图标。在将图标添加到超链接时:
<a href="#" class="icon-email icon-large">Email me!</a>
content
属性插入的内容在悬停时显示下划线文本修饰。我想仅针对前面的内容禁用text-decoration
。
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: 'IcoMoon';
font-style: normal;
speak: none;
}
.icon-mail:before {
content: "\37";
}
[class^="icon-large-"]:before, [class*=" icon-large"]:before {
font-size: 48px;
line-height: 48px;
}
a[class^="icon-"]:before, a[class*=" icon-"]:before {
margin-right: 5px;
vertical-align: middle;
}
我尝试过这个方法,但它并没有起作用(装饰仍然可见):a[class^="icon-"]:hover:before, a[class*=" icon-"]:hover:before {
text-decoration: none;
color: white;
}
icon-large
属性选择器可以简单地更改为.icon-large:before
(但我假设您只将其作为独立类而不是其他类的前缀)。 - BoltClock