【发布时间】:2014-01-13 21:13:55
【问题描述】:
感谢James Montagne's 的解决方案,我构建了一个单行图库,仅使用 CSS 即可在 specific behaviour 中缩放图像。
效果很好 - 除了 Chrome 27 及更高版本。这里图像的宽度保持在初始值,而高度正确缩放。
请查看this Fiddle或以下代码:
HTML:
<div>
<img src="http://placekitten.com/200/300" class="vert"/>
<img src="http://placekitten.com/500/200" class="horiz"/>
<img src="http://placekitten.com/200/300" class="vert"/>
<img src="http://placekitten.com/400/300" class="horiz"/>
<img src="http://placekitten.com/200/300" class="vert"/>
</div>
CSS:
body,html{
height: 100%;
}
div{
white-space: nowrap;
height: 100%;
}
img{
min-height: 200px;
height: 100%;
vertical-align: top;
}
.horiz{
max-height: 300px;
}
.vert{
max-height: 500px;
}
我已经翻遍了Chrome 27 changelog (~13MB),但没有找到任何有用的信息。
任何想法如何避免图像在 Chrome >= 27 中调整窗口大小时模糊?
【问题讨论】:
-
感谢您指出这篇文章,@Eisa!但它不提供仅 CSS 的解决方案。底线是:通过JS强制重绘。尽管我不喜欢在窗口调整大小事件上附加重绘,但我会记住这一点。
标签: css google-chrome image-scaling