这是我的代码:
<div style="width: 100vw; height: 100vh; background-image: url(img/kid1/1.jpg); background-attachment: fixed; background-size: cover"></div>
<div style="width: 100vw; height: 100vh; background-image: url(img/kid1/2.jpg); background-attachment: fixed; background-size: cover"></div>
它可以在我的笔记本电脑上使用 chrome,但不能使用 app chrome 或 android/ios(智能设备)上的任何网络浏览器。问题是我确实在 w3c practice mod 上尝试过这段代码,它在我的手机上确实有效,所以我的代码没有错,我的手机也没有错,所以这里有什么问题?我该如何解决这个问题?我是新手,所以这可能是一个菜鸟问题,但这个错误真的让我很生气......
最佳答案
background-attachment: fixed
许多手机浏览器不支持。
如果您在这里查看:http://caniuse.com/#feat=background-attachment ,您会看到在笔记本电脑上获得的结果与手机上的结果不同的原因。
到目前为止,我发现最好的办法是将手机上的图像视为没有视差的图像。
希望对你有帮助
关于html - 背景附件: fixed not working on android/ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38517364/