CSS背景图片在iPad和iPhone上调整不正确.

cha*_*hap 22 html css ios

我的网站的背景图片在Chrome和Safari中使用background-size:cover进行了很好的调整,但是当我在ipad或iphone上测试我的网站时,CSS背景图像实际上已经放大并且看起来很糟糕.我在这里读到了很多关于此问题的其他问题,但没有一个问题能解决我的问题.

HTML

<div class="background"> 

</div><!--background-->
Run Code Online (Sandbox Code Playgroud)

.background没有容器,屏幕宽度为100%.

CSS

.background {
    height:600px;
    width:100%;
    position:relative;
    background: url(css/img/strand.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}
Run Code Online (Sandbox Code Playgroud)

Eti*_*uis 52

我有同样的问题,我使用SCROLL而不是FIXED.

background-attachment:scroll;
Run Code Online (Sandbox Code Playgroud)

  • 在解决这个问题几个小时后,这个问题在几秒钟内解决了我的问题。谢谢你! (2认同)