css - 使用@2x.png 背景图片

标签 css retina

我们目前正在使用 SVG 和 PNG 回退在不同的站点上运行样式表。

这也适用于视网膜图像吗?

    background: url('/sfdt/mobile/images/template/sfdt-sprite_header-elements.png') -110px 0px / 190px no-repeat;
    background: url('/sfdt/mobile/images/template/sfdt-sprite_header-elements@X2.png') -110px 0px / 190px no-repeat;

或者像这样通过媒体查询运行它会更好吗?

@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
  only screen and (-o-min-device-pixel-ratio: 3/2),
  only screen and (min--moz-device-pixel-ratio: 1.5),
  only screen and (min-device-pixel-ratio: 1.5) {

谢谢

达里尔

最佳答案

通常以下行应该单独工作:

background: url('/sfdt/mobile/images/template/sfdt-sprite_header-elements@X2.png') -110px 0px / 190px no-repeat;

关于css - 使用@2x.png 背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22067582/

相关文章:

javascript - 冲突的组件 Joomla

html - 媒体查询不起作用

linux-mint - Linux mint 17 "mate"中的 HiDPI 选项在哪里

css - Macbook 视网膜 CSS : scrollable div scrollbar overlapped by parent scrollbar

html - CSS Sprite RWD + 视网膜

css - 一列 float 到左侧,其他填充页面的其余部分

html - 将人造列向下扩展到粘性页脚

html - 防止html页面被bot/crawler抓取缓存

ios - 带有 Retina-Tiles 的 MKTileOverlay

CALayers drawInContext 中的 iOS 绘图在视网膜上像素化或模糊