我正在使用Angular來遍歷html元素並顯示圖像。但圖像不填充縮略圖容器。我已將最大高度和寬度設置爲 max-height: 100%; max-width: 100%;
想用圖像填充縮略圖容器,使用ng-repeat Angularjs
但是圖像仍顯示在縮略圖容器的一部分上。
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>
嘗試用'最小高度:100%;' –
@ sachila ranawaka我試過,但沒有奏效。謝謝 –
從'.thumbnail'中刪除10%填充。另外,如果圖像尺寸不是350 x 275;會有填充'.thumbnail'容器的問題。 – ZimSystem