我使用了以下 CSS 来创建固定的正文背景。它适用于几乎所有浏览器,除了新的 iOS7。在后者上,背景不再固定。它随页面滚动。知道如何解决这个问题吗?
body {
background-color: #000;
background-image: url('../pics/backgrounds/blackWhite.jpg');
background-repeat: no-repeat;
background-position: center;
background-attachment: fixed;
webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
干杯
最佳答案
我会尝试找到一些引用,但移动浏览器强制使用 background: scroll
,因为重新绘制太昂贵了。
引用:
CSS - Background images not displaying properly on mobile browsers
@PaulIrish还注意到这一点:
Fixed-backgrounds have huge repaint cost and decimate scrolling performance, which is, I believe, why it was disabled.
虽然有很多方法可以解决这个问题......但这不是一个快速的解决方案。 查看以下问题及其评论。
Android/Mobile Webkit CSS Background-Attachment:Fixed Not Working?
关于html - 固定正文背景滚动与 iOS7 上的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19045364/