垂直对齐具有响应高度的div内的图像
<div class="responsive-container"> <div class="dummy"></div> <div class="img-container"> <IMG HERE> </div></div>
.responsive-container { position: relative; width: 100%; border: 1px solid black;}.dummy { padding-top: 100%; /* forces 1:1 aspect ratio */}.img-container { position: absolute; top: 0; bottom: 0; left: 0; right: 0;}
慕容森