1
如何在图像顶部水平和垂直居中放置此笑脸,同时将其拉伸至其容器大小的50%?使用flex居中和拉伸背景
I.e.像:
.test {
display: flex;
}
.test .smile {
background-image: url(https://rawgit.com/anonymous/9f37047667b06af42c3d/raw/65a00b0f38b05bb6c96fa827993dbae31fe391b3/test.svg);
background-repeat: no-repeat;
justify-content: center;
align-content: center;
flex-direction: column;
height: 50%;
width: 50%;
}
<div class="test">
<a>
<img src="http://lorempixel.com/400/400">
<span class="smile"></span>
</a>
</div>
很酷,谢谢。 – 2014-11-04 15:15:54