css - 每当我滚动我的页面时,我的背景也会滚动如何解决这个问题?

标签 css

这是我的CSS代码

.bg-main {
    background: linear-gradient(0deg,rgba(0,0,0,0.5),rgba(0,0,0,0.5)), url(../img/mother.png) no-repeat center center fixed !important; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover !important;
}

最佳答案

从它的样式中移除fixed

background: linear-gradient(0deg,rgba(0,0,0,0.5),rgba(0,0,0,0.5)), url(../img/mother.png) no-repeat center center !important; 
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover !important;

关于css - 每当我滚动我的页面时,我的背景也会滚动如何解决这个问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49253178/

相关文章:

html - 由于向右滚动条,水平菜单栏向左移动了一点

javascript - 使用 D3 制作没有 mustache 的彩色箱线图

css - 添加标题移动 Div

javascript - 添加到 YouTube 的 Canvas 不可见

html - 如何将文本对象放置在页面下方 90% 的位置?

css - 线性渐变边框底部不起作用

javascript - 一段时间后使用jQuery更改文本?

css - SCSS for Loops - 生成更短/组合的代码

javascript - 使用媒体查询设置背景图像的不透明度

javascript - 无序发生的属性更改的 Angular 事件