Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当我设置了background-attachment: fixd, 背景图片显示效果不对,应该如何调整 #39

Open
MatthewTt opened this issue May 18, 2024 · 1 comment

Comments

@MatthewTt
Copy link

background-repeat: no-repeat;
  background-size: 100%;
 background-attachment: fixed;

存在该属性

image

不存在该属性

image

原图

@wswmsword
Copy link
Owner

你好,我测试了下。在设置 background-attachment: fixed 之后,background-size 的尺寸就不是基于当前元素的了,正常情况是基于浏览器视口的,所以您这个问题是出现在宽屏上吗?
这个 background-attachment: fixed 的作用是在滚动父级元素的时候,保持背景不变,但是如果这个背景已经是您 App 的最外层了,好像就没必要设置 fixed 值了,默认 scroll 或者删掉这个属性应该就行,是不是这个属性的用法您用错了?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants