Chrome没有显示合适的srcset图片
Chrome does not display suitable srcset picture
我正在尝试将 img srcset 属性与 Chrome 一起使用,但它不显示 srcset 合适的图片。我用两个不同的 1x 设备在 Linux (Chromium 41) 和 Windows (Chrome 42) 上测试它。
我设置了两张图片:512px和1054px宽的图片。但是 Chrome 仍会在视口宽度为 734px 或更小时显示 512px 图片,在视口宽度为 735px 或更大时显示 1054px 图片。
它在 Firefox 上运行良好(在配置中启用 srcset)。
为什么Chrome在视口宽度大于512px时显示512px的图片?
body {
background-color: #000;
}
img {
max-width: 100%;
}
<img srcset="
http://download.blender.org/institute/logos/blender-socket.png 512w,
http://download.blender.org/institute/BlenderDesktopLogo.png 1054w" sizes="100vw">
代码笔 link :
http://codepen.io/anon/pen/dooQvJ
有关升级问题的 chromium 问题已打开:
https://code.google.com/p/chromium/issues/detail?id=456084
放大似乎是显示 srcset 图片的实际 Chromium 算法:
The upscaling is by design. As a compromise between over-downloading
and image quality we "draw a line" between the resources at their
geometric mean. We may change that behavior in the future based on
network condition, user preferences, current DPR, etc.
我正在尝试将 img srcset 属性与 Chrome 一起使用,但它不显示 srcset 合适的图片。我用两个不同的 1x 设备在 Linux (Chromium 41) 和 Windows (Chrome 42) 上测试它。
我设置了两张图片:512px和1054px宽的图片。但是 Chrome 仍会在视口宽度为 734px 或更小时显示 512px 图片,在视口宽度为 735px 或更大时显示 1054px 图片。
它在 Firefox 上运行良好(在配置中启用 srcset)。
为什么Chrome在视口宽度大于512px时显示512px的图片?
body {
background-color: #000;
}
img {
max-width: 100%;
}
<img srcset="
http://download.blender.org/institute/logos/blender-socket.png 512w,
http://download.blender.org/institute/BlenderDesktopLogo.png 1054w" sizes="100vw">
代码笔 link : http://codepen.io/anon/pen/dooQvJ
有关升级问题的 chromium 问题已打开: https://code.google.com/p/chromium/issues/detail?id=456084
放大似乎是显示 srcset 图片的实际 Chromium 算法:
The upscaling is by design. As a compromise between over-downloading and image quality we "draw a line" between the resources at their geometric mean. We may change that behavior in the future based on network condition, user preferences, current DPR, etc.