每次我滚动时,无论我滚动到哪里,背景文本都会跟随。我怎样才能让它保持在我想要的位置。
.bg-image {
background-image: url(../construction/3.jpg);
filter: blur(8px);
-webkit-filter: blur(8px);
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-text {
background-color: #000;
background-color: #000;
color: white;
font-weight: bold;
border: 3px solid #f1f1f1;
position: absolute;
margin: auto;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
width: 80%;
padding: 20px;
text-align: center;
}
最佳答案
如果你固定图像,你可以使用:
.你的类(class){
背景图像:url(“您的图像”);
背景重复:不重复;
背景附件:已修复;
}`
关于css - 为什么滚动时我的背景会移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53679692/