删除图像中的空白
我有很多图像,我的代码如下。删除图像中的空白
某些图像顶部或左侧的某些图像中存在空白区域。我找不到如何解决它。我已经设置了宽度和最大宽度。
我将图像保存为tmb文件。它可能是由于它?
我该怎么解决?谢谢!
.pbombd-thumbnail {
\t float:left;
\t margin-top: 10px;
\t margin-right: 17px;
\t width: 220px;
\t padding: 0px !important;
\t border-radius: 4px;
\t border: 0px;
}
.pbombd-img-thumb
{
\t
\t max-width:218.4px;
\t max-height: 178px;
\t min-width: 218.4px;
\t min-height: 178px;
\t margin:0px;
\t border-top-left-radius: 4px;
\t border-top-right-radius: 4px;
}
<div class="thumbnail pbombd-thumbnail">
<a href="#">
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97350&w=350&h=350" class="pbombd-img-thumb"/>
</a>
</div>
编辑: 我忘了在问题补充这个CSS:
.thumbnail { display: block; padding: 4px; margin-bottom: 20px; line-height: 1.42857; background-color: #FFF; border: 1px solid #DDD; border-radius: 4px; transition: all 0.2s ease-in-out 0s; }
添加display: block;
到.pbombd-img-thumb
。显示为inline
或inline-block
可能会导致额外的空间。
.pbombd-thumbnail {
\t float:left;
\t margin-top: 10px;
\t margin-right: 17px;
\t width: 220px;
\t padding: 0px !important;
\t border-radius: 4px;
\t border: 0px;
background-color: orange;
}
.pbombd-img-thumb
{
display: block;
\t max-width:218.4px;
\t max-height: 178px;
\t min-width: 218.4px;
\t min-height: 178px;
\t margin:0px;
\t border-top-left-radius: 4px;
\t border-top-right-radius: 4px;
}
<div class="thumbnail pbombd-thumbnail">
<a href="#">
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97350&w=350&h=350" class="pbombd-img-thumb"/>
</a>
</div>
我试过了,但它是一样的。我编辑了我的问题。我为缩略图类添加了css。 –
尝试增加vertical-align: middle;
到img元素的CSS。一些媒体元素有空白区域。
没有任何变化。 –
你的图片的高度和宽度是否相同? –