image - 我应该在 srcset 属性中包含哪些分辨率?

标签 image responsive-design retina-display srcset pixel-ratio

在 srcset 属性中包含哪些分辨率才有意义? MediaWiki 使用 1.5x2x。有没有例如有哪些设备可以使用 3x

编辑:最后一个问题的答案 seems to be “yes” .

2015 年 10 月编辑:为了满足大多数设备的需求,图像版本尽可能少,1.5x2x3x似乎是要走的路

编辑 2023 年 6 月:1.5x2x3x 似乎仍然合理。已接受答案中的设备列表已更新

最佳答案

以下是一些设备和比率的不完整列表:


1.3x

    Google Nexus 7

1.5x

    Google Nexus S
    Samsung Galaxy S II
    HTC Desire
    HTC Incredible S
    HTC Velocity
    HTC Sensation
    Nokia Lumia 900

2x

    iPhone 4
    iPhone 4S
    iPhone 5
    iPhone 6
    iPhone 7
    iPad (3rd generation)
    iPad 4
    All Retina displays Mac
    Google Galaxy Nexus
    Google Nexus 4
    Google Nexus 10
    Nokia Lumia 920
    Nokia Lumia 925
    Samsung Galaxy S III
    Samsung Galaxy Note II
    Sony Xperia S
    HTC One X

2.6x
    Nokia Lumia 930

3x
    Xperia Z
    Xiaomi 2
    Galaxy Note
    HTC One (M7)
    HTC Butterfly
    Samsung Galaxy S IV

这是规范的答案:

The srcset attribute is used with the src attribute, which gives the URL of the image to use for legacy user agents that do not support the srcset attribute. This leads to a question of which image to provide in the src attribute.

The answer that results in the least duplication is to provide the image suitable for an infinite width and infinite height viewport with a pixel density of 1 CSS pixel per device pixel.

引用文献

关于image - 我应该在 srcset 属性中包含哪些分辨率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21183068/

相关文章:

javascript - Canvas 比普通图像快吗?

html - 图像放大

html - Bootstrap 交替布局以堆叠在移动设备中

css - 我的移动网站出现水平滚动

c# - 单色触摸 : Doubling Appearance Image size when Hue adjusted on Retina display

css - 如何在div中获取图片?

html - 调整图像大小,保持比例,html?

javascript - 页面加载期间 IE 中没有图像的高度和宽度

ios - SKTexture 和 UIImage 的缩放属性

ios - Xcode 4.3.2 "Invalid Icon"适用于 iPad 视网膜显示屏