简体   繁体   English

iOS4中的像素化,但iOS5中不是

[英]Pixelation in iOS4 but not iOS5

I have an image tag with width attribute in px in my html. 我在HTML中的px中有一个width属性为image的图像标签。 Running this html in iPad having IOS4 results in a clear image whereas in IOS5 it looks pixelated. 在具有IOS4的iPad中运行此html可以得到清晰的图像,而在IOS5中则看起来像素化。 Please suggest. 请提出建议。

I chose to follow the naming convention Apple uses in its SDK to target the high-res images by adding the suffix “@2x” to the file-name. 我选择遵循Apple在其SDK中使用的命名约定,即在文件名中添加后缀“ @ 2x”来定位高分辨率图像。 So for low-res devices, if the standard icon is “icon.png”, the RD devices would be “icon@2x.png”. 因此,对于低分辨率设备,如果标准图标为“ icon.png”,则RD设备为“ icon@2x.png”。 To get these into the mix, I added a media query into the css file that targets the Retina Display: 为了将这些混合在一起,我在针对视网膜显示屏的css文件中添加了媒体查询:

@media all and (-webkit-min-device-pixel-ratio: 2) {
    #home-news a {background-image:url(images/icon@2x.png);}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM