简体   繁体   English

视差图像模糊/ V。 在iPhone上像素化。 需要CSS提示

[英]Parallax images blurred/V. pixelled on iphone. Need CSS hint

I am working on a website and have run into a problem. 我在一个网站上工作,遇到了问题。

The background images look really pixellated on iphone screens. 背景图像在iPhone屏幕上看起来确实像素化。

This is the HTML I am using 这是我正在使用的HTML

<div class="parallax img-overlay3" style="background-image:url(img/pictures/food02.jpg)" data-stellar-background-ratio="0.2">

When I look using something like http://mobiletest.me/iphone_5_emulator It looks perfect, but actually looking in the iphone the images seem to be zoomed into a small part of any image I put in there. 当我使用http://mobiletest.me/iphone_5_emulator之类的东西时,它看起来很完美,但实际上在iphone中查看时,图像似乎被放大到了我放在其中的任何图像的一小部分。 Have Googled for a few hours and it seems to be a problem with no clear answer. 谷歌搜索了几个小时,这似乎是一个没有明确答案的问题。

You need to keep in mind that there are devices that are capable to display images with a resolution higher than 72ppi. 您需要记住,有些设备能够显示分辨率高于72ppi的图像。 For example, the new iPhone 6 plus has 401ppi. 例如,新的iPhone 6 plus具有401ppi。 You need to provide additional images for these devices. 您需要为这些设备提供其他图像。 To do so use a media query with Device-pixel-ratio: 2. This is enough. 为此,请使用具有Device-pixel-ratio的媒体查询:2.这足够了。 There are also JavaScript solutions for that, but I think you can use Google to find them. 也有针对此的JavaScript解决方案,但我认为您可以使用Google来找到它们。

Take a look at this for more CSS snippets: http://stephen.io/mediaqueries/ 看看下面的更多CSS片段: http : //stephen.io/mediaqueries/

I'm having this exact same issue (figure8recording.com), but I don't think its necessarily related to the retina images, I get proper looking images on retina devices when I removed the fixed background-attachment.. 我遇到的是完全相同的问题(figure8recording.com),但我认为它不一定与视网膜图像有关,当我移除固定的背景附件时,在视网膜设备上可以获得正确的外观图像。

I think any image with 'background-position: fixed' will enlarge the image to the size of the entire document body, when I set 'background-position: scroll' on mobile devices the images look nice and are positioned correctly. 我认为任何具有“背景位置:固定”的图像都会将图像放大到整个文档正文的大小,当我在移动设备上设置“背景位置:滚动”时,这些图像看起来不错并且位置正确。

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

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