我发现This文章,但我想在:: before和:: after内容属性中使用图片,而不是字体图标。Css - 将图片用于伪元素
原文:
.icon-dribbble:before, .icon-dribbble:after {
content: "\e007";
}
最好的我想出迄今(它不工作,PIC确实出现,但如预期一样在文章中它不工作):
.icon-dribbble:before, .icon-dribbble:after {
background-image: url('icon.png');
background-repeat:space;
background-size: 40px 40px;
background-position:center;
top:0px;
content: "";
}
添加'显示:块; height:40px;宽度:40px'呢? – LinkinTED
“不按预期工作”是什么意思?另外,'background-repeat:space;'不是'background-repeat' AFAIK的有效值。 –
你能创建一个演示吗? –