在iPad和iPhone上,我的网站背景不显示。在其他浏览器上运行正常(Safari、Chrome、IE和Mozilla)
我的css代码是:
background:url(../photos/shutterstock2.jpg);
background-size:2800px 1500px;
background-repeat:no-repeat;
background-color: #94C5EB;发布于 2012-09-16 17:44:54
试试这个:
html {
background: url(../photos/shutterstock2.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-color: #94C5EB;
}我们可以完全通过CSS来完成这项工作,这要归功于现在CSS3中的背景大小属性。我们将使用html元素(比body更好,因为它始终至少是浏览器窗口的高度)。我们在它上面设置一个固定的居中背景,然后使用设置为cover关键字的background-size来调整它的大小。
这应该会给你一种很棒的、渐进的CSS3方式!
https://stackoverflow.com/questions/12445673
复制相似问题