代码
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
div {
height: 100vh;
background: rgba(0, 0, 0, .7);
color: #fff;
line-height: 100vh;
text-align: center;
font-size: 20vh;
}
.img1{
background-attachment: fixed; /*背景相对于浏览器固定 视差滚动关键*/
background-size: cover; /*将图片放大直到铺满整个容器*/
background-position: center center; /*左右上下居中*/
background-image: url("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F1114%2F0G020114924%2F200G0114924-15-1200.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1658835043&t=dd74082e5025a0f4f87530900371344b");
}
.img2{
background-attachment: fixed;
background-size: cover;
background-position: center center;
background-image: url("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F1113%2F0F420110430%2F200F4110430-6-1200.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1658835043&t=405bde91b907771427c6e55e9a480dde");
}
.img3{
background-attachment: fixed;
background-size: cover;
background-position: center center;
background-image: url("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftp09%2F210F2130512J47-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1658835043&t=d66d9f36c430b399ff81b507359e4efe");
}
</style>
</head>
<body>
<div class="text">1</div>
<div class="img1">2</div>
<div class="text">3</div>
<div class="img2">4</div>
<div class="text">5</div>
<div class="img3">6</div>
<div class="text">7</div>
</body>
</html>