【发布时间】:2016-02-26 21:11:35
【问题描述】:
如果有办法使用<div> 内的<img> 标签“模仿”background-size:cover; 的行为(参见http://www.w3schools.com/cssref/playit.asp?filename=playcss_background-size&preval=cover)。我想要这样的结构:
<div style="width:100%, height=30%">
<img ng-src="{{data.imageData}}"/>
</div>
对不起,如果我不是很清楚这个话题,我不知道,如何说得更清楚。
【问题讨论】:
-
添加
img {width:100%; height:auto;}怎么样 -
其中一个取决于图像及其容器的纵横比:
{width: 100%; height: auto}或{width: auto; height: 100%}