我试图让这个背景图像重新应用以覆盖 div 容器。我希望它保持相同的大小,这样当屏幕比例发生变化时它就不会“放大”。但是,目前,它只是放大而不是保持相同的大小:
.top-container {
background: background: -webkit-linear-gradient(70deg, #790c5a 30%, rgba(0,0,0,0) 30%), -webkit- linear-gradient(30deg, #cc0e74 60%, #e6739f 60%);
background: -o-linear-gradient(70deg, #790c5a 30%, rgba(0,0,0,0) 30%), -o-linear-gradient(30deg, #cc0e74 60%, #e6739f 60%);
background: -moz-linear-gradient(70deg, #790c5a 30%, rgba(0,0,0,0) 30%), -moz-linear-gradient(30deg, #cc0e74 60%, #e6739f 60%);
background: linear-gradient(70deg, #790c5a 30%, rgba(0,0,0,0) 30%), linear-gradient(30deg, #cc0e74 60%, #e6739f 60%);
padding-top: 5px;
padding-bottom: 5px;
text-align: center;
position: relative;
z-index: 1;
}
.top-container:before {
content: "";
background: url("./../images/skulls.PNG") no-repeat center center fixed;
background-repeat: no-repeat;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-position: center;
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
opacity: 0.2;
width: 100%;
height: 100%;
}
有什么建议吗?
编辑:图像已经非常小,所以我想要的是它保持相同的大小,并不断重新应用以适应 div。但不是这样做,它只是放大,这会扭曲图像。