我需要一种方法来覆盖 Bootstrap 的字形图标样式并使用传统的 CSS 背景属性而不破坏现有标记(例如 <i class="glyphicon glyphicon-comment"></i>
)
这是我的尝试,但还是不行:
.glyphicon-comment:before {
content: none;
}
.glyphicon-comment {
background: transparent url('someurl') no-repeat 0 -380px;
}
编辑:
通过为 glyphicon 类指定高度和宽度来解决,如下所示:
.glyphicon {
width:14px;height:14px
}
最佳答案
这适用于 http://getbootstrap.com :
.glyphicon.glyphicon-comment:before {
content: none;
}
如果你不想保留图标的空间,你也可以试试
.glyphicon.glyphicon-comment {
display: none
}
关于css - 覆盖字形以使用旧时尚背景属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21159272/