div盒子中使里面图片垂直居中的方法
父盒子采用相对定位,子盒子绝对定位
css代码如下:
.bbb{
position: relative;
text-align: center;
background-color: #f9f9fb !important;
}
.bbb img{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin:auto;
}
html代码如下:
<div class="bbb">
<img src="img/ios/图层9@2x.png" alt="">
</div>


浙公网安备 33010602011771号