\ absolute绝对定位的inline-block化 >> 张鑫旭-鑫空间-鑫生活

absolute绝对定位的inline-block化实例页面

代码:

CSS代码:
.div { padding:20px; margin-bottom:10px; background-color:#f0f3f9; }
.abs { position:absolute; }
                
HTML代码:
<div class="div">
    <img src="//image.zhangxinxu.com/image/study/s/s256/mm1.jpg" />
    <p>无absolute</p>
</div>
<div class="div abs">
    <img src="//image.zhangxinxu.com/image/study/s/s256/mm1.jpg" />
    <p>absolute后</p>
</div>
                

效果:

无absolute

absolute后