我正在使用 Angular 遍历 html 元素并显示图像。但是图像没有填充缩略图容器。我已将最大高度和宽度设置为
最大高度:100%;
最大宽度: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>
最佳答案
从 .thumbnail
.. 中删除填充
.row .col-md-12 .thumbnail{
display: inline-block;
width: 350px;
position:relative;
}
img {
max-height: 100%;
max-width: 100%;
}
关于html - 想要用图像填充缩略图容器,使用 ng-repeat Angularjs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42677837/