我有html:
<div class="social-section">
<a href="#" class="glyphicons facebook"><i></i></a>
<a href="#" class="glyphicons twitter"><i></i></a>
</div>
当鼠标悬停时,我希望使用 CSS3 过渡让图标淡化为不同的颜色。不幸的是,如果可能的话,我不确定如何进行这项工作。我目前对 css 的尝试是:
.social-section * i:before { /* Apply this to the i:before, when the a is hovered */
-webkit-transition: all 0.3s ease-in;
-moz-transition: all 0.3s ease-in;
-ms-transition: all 0.3s ease-in;
-o-transition: all 0.3s ease-in;
transition: all 0.3s ease-in;
}
.social-section a i:before {
color: red;
}
.social-section a:hover i:before {
color: black;
}
如果这有帮助,这里是 Glyphicons 字体 css 代码的相关部分:
.glyphicons {
display: inline-block;
position: relative;
padding: 0 0 5px 35px;
*display: inline;
*zoom: 1;
}
.glyphicons i:before {
position: absolute;
left: 0;
top: 0;
font: 20px/1em 'Glyphicons';
font-style: normal;
color: red;
}