我在 <body>
上实现了背景图片以下网站的元素:http://www.bestdiscointown.co.uk/dev/ - 这是为了在用户滚动到页面底部时显示图像(以下屏幕截图显示这在 Firefox 中工作):
这是通过以下 CSS 实现的,并且在大多数网络浏览器中表现良好:
body {
color: #fff;
font-family: 'proxima_nova_ththin';
background-image: url("custom-assets/img/body_bg.jpg");
background-position: center top;
background-repeat: no-repeat;
background-attachment: fixed;
}
但是在 iOS 9.3.5 上的 Safari 中查看时出现以下问题并且背景图像被切断:
出现这个问题有什么原因吗,会不会是我设置了
background-attachment: fixed;
?可以在我的 CSS 中应用修复来解决这个问题吗?
最佳答案
众所周知,由于假定的性能问题,iOS 不会保持背景固定(通过 background-attachment: fixed
)。您可以在此处阅读更多信息:https://stackoverflow.com/a/23420490/1887218
您可以做一个解决方法,将背景添加到全屏包装器,该包装器设置了 position: fixed
。看这里:https://stackoverflow.com/a/12770538/1887218
关于ios - body 上设置的背景图像被切断的问题 - iOS/Safari,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39417352/