【发布时间】:2014-01-22 08:18:57
【问题描述】:
我在表格中显示 img 时遇到问题:
<table>
<tr>
<td>
<div>
<img src="https://www.google.ru/images/srpr/logo4w.png"/>
<img src="http://pictar.ru/data/media/24/nature__463_.jpg"/>
</div>
</td>
</tr>
</table>
用css:
div {
height: 100%;
width: 100%;
border:2px solid red;
}
div img {
max-width: 100%;
max-height: 100%;
}
JS Fiddle example。
在 Chrome 中,两个图像都与 div-wrapper 成比例缩放,但在 Firefox 和 IE9 中,图像不会缩放。
如何让 Chrome 的行为无处不在?
回答: 唯一的解决方案是使用 javascript。我的跨浏览器解决方案是:http://jsfiddle.net/TAE3w/21/
【问题讨论】:
标签: google-chrome firefox html-table css