我的网站背景图片在Chrome和Safari中使用background-size:cover调整大小非常好,但是当我在ipad或iphone上测试我的网站时,CSS背景图片真的被放大了,看起来很糟糕。我已经阅读了许多其他与此有关的问题,在这里没有解决我的问题。
HTML
<div class="background">
</div><!--background-->
.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;
}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
。 - chap