- HTML中文网
- 联系QQ:88526
- QQ交流群

- 微信公众号

image-set()
image-set() = image-set( <image-set-option># )
<image-set-option> = [ <image> | <string> ] <resolution>
为不同的设备分配合适得图像;
示例
div { background-image: image-set( "test.png" 1x, "test-2x.png" 2x, "test-print.png" 600dpi ); }
上述代码将会为普通屏幕使用 test.png,为高分屏使用 test-2x.png,如果更高的分辨率则使用 test-print.png,比如印刷。
浅绿 = 支持
红色 = 不支持
粉色 = 部分支持
IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|
6.0-11.0 | 2.0-38.0 | 4.0-20.0 | 3.1-5.1 | 15.0 -28.0-webkit- | 3.2-5.1 | 2.1-4.3 | 18.0-20.0 |
21.0- 43.0-webkit- | 6.0- 8.1-webkit- | 6.0- 8.1-webkit- | 4.4 -4.4.4-webkit- | 21.0 -43.0-webkit- |
需要注意的是,目前带有-webkit-
的这些浏览器支持的语法是:image-set( <url> | <string> )
,写法如下:
示例
div { background-image: image-set( url(test.png) 1x, url(test-2x.png) 2x ); }
推荐手册