我的按钮和文字应保留在背景尺寸上并具有响应性。
当我放大时会发生这种情况。
CSS -
#bg {
height: 100vh;
background-image: url('../../assets/img/2.png'); /* Background Image Link */
background-size: 102%;
background-repeat: no-repeat;
position: relative;
}
.container1 {
display: table;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
我做错了什么?
答案 0 :(得分:0)
在CSS中,它应该是:background-size: cover;
#bg {
height: 100vh;
background-image: url('../../assets/img/2.png');
background-size: cover; /*Change Here*/
background-repeat: no-repeat;
position: relative;
}