【发布时间】:2017-03-09 02:34:54
【问题描述】:
我正在使用 Angular 循环一个 html 元素并显示一个图像。但是图像没有填充缩略图容器。我已将最大高度和宽度设置为
max-height: 100%;
max-width: 100%;
但图像仍显示在缩略图容器的一小部分。
CSS
.row .col-md-12 .thumbnail{
display: inline-block;
width: 350px;
height: 275px;
padding: 10%;
position:relative;
}
img {
max-height: 100%;
max-width: 100%;
}
HTML
<ul class="col-md-12" >
<li class="thumbnail" ng-repeat="course in courses" >
<a ui-sref="course({id:course.id})">
<img ng-src="{{course.picture}}" alt="" />
</a>
</li>
</ul>
【问题讨论】:
-
试试
min-height: 100%; -
@sachila ranawaka 我试过了,但没有用。谢谢
-
从
.thumbnail中删除 10% 的填充。此外,如果图像尺寸不是 350 x 275;填充.thumbnail容器时会出现问题。 -
一切正常,图像现在已满容器。图像的大小超过 350 x 275。大多数是 600 X 400。
标签: html css angularjs image twitter-bootstrap