CSS - ::after 伪元素
CSS - The ::after Pseudo-element
我想将图像放在 span 元素之前。但是图像太大了。我可以使用 ::after 伪元素更改图像的大小吗?
谢谢
这是在 <span>
之前添加图像的方法。
span{
margin-left:100px;
}
span:before{
content:'';
width:100px;
height:100px;
left:5px;
position:absolute;
background-image : url("https://source.unsplash.com/random");
}
<span> hi </span>
我想将图像放在 span 元素之前。但是图像太大了。我可以使用 ::after 伪元素更改图像的大小吗? 谢谢
这是在 <span>
之前添加图像的方法。
span{
margin-left:100px;
}
span:before{
content:'';
width:100px;
height:100px;
left:5px;
position:absolute;
background-image : url("https://source.unsplash.com/random");
}
<span> hi </span>