背景固定:固定在Chrome上向后移动 [英] background-attachment: fixed moving backwards on Chrome
问题描述
我在Chrome(macOS中为v67)上的 background-position:fixed
遇到了一个非常奇怪的错误,该背景图片实际上在我滚动时会向上移动,而不是被 fixed
.
I'm experiencing a very strange bug with background-position: fixed
in Chrome (v67 on macOS) where the background image actually moves up when I scroll, rather than being fixed
.
这是该问题的一个代码笔: https://codepen.io/alexismo/pen/xzwmRE这是它的一个gif: https://gfycat.com/PolishedHarshAfricangroundhornbill
Here is a codepen of the issue: https://codepen.io/alexismo/pen/xzwmRE and here is a gif of it: https://gfycat.com/PolishedHarshAfricangroundhornbill
页面内容的结构如下
<body>
<div class="background-image"></div>
<div class="rest-of-the-site"></div>
</body>
.background-image {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-position: center;
background-size: cover;
background-attachment: fixed;
z-index: -1;
}
推荐答案
这看起来像是最新版本的Chrome中的错误.这不是预期的行为.如果尚未输入错误报告,我建议您提交.
This looks like a bug in the latest release of Chrome. This is not the intended behavior. I would recommend filing a bug report if one is not already entered.
这篇关于背景固定:固定在Chrome上向后移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!