我有一个div,希望在其中居中显示多张图片。所有的图片都具有相同的高度和宽度,均为16像素。问题是,我要么把它们居中显示但是下方留有额外的空白,要么使用display:block去掉空白但又回到了左对齐。以下是我的代码:
我想包含这些图片的div:
.cell{
position: relative;
float: left;
width: 300px;
min-height: 22px;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
line-height: 22px;
font-family: Arial, Verdana;
font-size: 12px;
color: #000;
text-decoration: none;
text-align: center;
margin-bottom: 2px;
margin-right: 2px;
}
上述类通常具有所需的属性。 因此,我想创建一个用于 img 元素的类,以便它们可以相互对齐并水平排列。
有什么有效建议吗?! :)
min-height: 22px;
,因此由于你的图片是16px,底部会有额外的空间。 - PREEB