vue中背景图片的设置
这种设置方式能够让背景图片随着浏览器缩放而缩放
#index {
width: 100%;
height: 4300px;
background-image: url('./images/newyear.jpg'); //背景图片路径
background-repeat: no-repeat;
background-position: center;
background-size: 1920px 4300px;
}
设置背景图片上的布局能够随着背景图片缩放而缩放
.container {
width: 1200px;
height: 170px;
margin: 0 auto; //关键
background: #dddddd;
position: relative;
top: 430px;
}
未缩放时的样子:
缩放后: