固定大小的图像容器

时间:2013-04-18 10:40:22

标签: html css

我有以下图片容器:

<div class="images">
    <img src="<%=imageURL %>" />
</div>

.images的css是:

.images{
display:inline-block;
width:100px;
height:133px;
overflow:hidden;
}

我的图像具有不同的尺寸,这就是为什么我使用上面的div胶囊使它们的大小相同。但在页面中,我的图像是这样的:

enter image description here

他们的上衣没有对齐。我该如何纠正?

2 个答案:

答案 0 :(得分:2)

添加vertical-align:top

.images{
    display:inline-block;
    width:100px;
    height:133px;
    overflow:hidden;
    vertical-align:top
}

答案 1 :(得分:0)

使用float

.images{
       float:left;
       width:100px;
       height:133px;
       overflow:hidden;
      }
相关问题