2015-06-03 77 views
1

这里是我的CSS类背景图片(居中)在iPhone

.parallax { 
     background: url(../images/indexParallax.png) no-repeat center center fixed; 
     display: table; 
     height: 100%; 
     position: relative; 
     width: 100%; 
     -webkit-background-size: cover; 
     -moz-background-size: cover; 
     -o-background-size: cover; 
     background-size: cover; 
     overflow: hidden; 
} 

在台式电脑和Android手机,正确显示该视差。但是当涉及到iPhone(4和5和6)时,就会出现问题。图像显示但没有正确缩放背景图像。

任何想法?谢谢。

+0

我相信'背景附件:fixed'不会在iOS – zgood

回答

0

我还没有尝试过这个自己,但这里是一个应该解决

-webkit-background-size: 100%; 
-moz-background-size: 100%; 
-o-background-size: 100%; 
background-size: 100%; 
-webkit-background-size: cover; 
-moz-background-size: cover; 
-o-background-size: cover; 
background-size: cover; 

基本上,如果浏览器无法使用盖,然后它会采取100%,这应该提供类似的结果。

background-size: cover;bugged在iOS

+0

Unforunately -webkit-背景大小的某些版本中工作:100%;没有达到与-webkit-background-size:cover相同的结果;这应该是视差,当我设置100%时,那只是我们没有覆盖整个背景的图像 – user3100193