:after伪类+content 清除浮动的影响
.box{padding:10px; background:gray;}
.l{float:left;}
<div class="box">
<img class="l" src="http://image/imagemm1.jpg" />
</div>
.fix:after{display:block; content:"clear"; height:0; clear:both; overflow:hidden; visibility:hidden;}
:after伪类+content 让大小不固定图片垂直居中
.pic_box{width:300px; height:300px; background-color:#beceeb; font-size:0; *font-size:200px; text-align:center;}
.pic_box img{vertical-align:middle;}
.pic_box:after{display:inline-block; width:0; height:100%; content:"center"; vertical-align:middle; overflow:hidden;}
<div class="pic_box">
<img data-src="http://image/mm1.jpg" />
</div>