Css 如何固定背景色?
我的问题,可能看起来很愚蠢。但事实并非如此,即使我也这么认为 我有一个梯度在我的背景色,使背景图像的效果是在它下面的位置固定Css 如何固定背景色?,css,gradient,background-color,fixed,Css,Gradient,Background Color,Fixed,我的问题,可能看起来很愚蠢。但事实并非如此,即使我也这么认为 我有一个梯度在我的背景色,使背景图像的效果是在它下面的位置固定 body{ background-image:url(...); background-attachment: fixed; } body:after{ content: ""; display: block; background-attachment: fixed; position: absolute; height: 100%;
body{
background-image:url(...);
background-attachment: fixed;
}
body:after{
content: "";
display: block;
background-attachment: fixed;
position: absolute;
height: 100%;
width: 100%;
background: -moz-linear-gradient(-45deg, rgba(30,87,153,1) 0%, rgba(89,148,202,1) 62%, rgba(95,154,207,0.7) 68%, rgba(125,185,232,0) 100%);
}`
我希望,我已经足够精确了。如果你需要更多的信息,不要犹豫
谢谢大家! 如果这是您想要的:
- 身体上的固定背景图像
- 在上面有一个固定的背景,模糊了大部分的背景图像
top:0; left:0;
z-index:-1;
到主体::after
,并将其位置:绝对
更改为位置:固定
z索引是必需的,因为否则::after将位于主体本身的内容之上
请参阅。问题在于具体是什么?那么您想要实现什么?我只想在背景图像上加一个渐变。当我向下滚动的时候,没有什么可以抱怨的。我希望你能理解。