div>img 底部对齐

Friday, June 10, 2011

外层div的位置设置成绝对的, img 设置成块级元素,位置设置成相对的,bottom设置成0

html code

<div class="bodyShape">
    <div class="barbara">
        <img src="${tools.static_url('media/images/figure-analysis-barbara-82x135.png')}" />
    </div>
</div>

css code

.bodyShape{height:150px; width:200px;border-right: 2px solid #ccc;}
.bodyShape .barbara{position:relative;height:100%;}
.bodyShape .barbara img{bottom:0;display:block;position:absolute;}

This entry was tagged CSS

comments powered by Disqus

© 2009-2013 lxneng.com. All rights reserved. Powered by Pyramid

go to Top