背景图不动,上面内容滚动
div{
padding:10% 0;
}
div p{
display:block;
height:500px;
background-image:url('./images/1.jpg');
background-attachment:fixed;
background-size:cover;
color:transparent;
}
<div>
<p>占位符</p>
<p><img src="./images/4.jpg"/></p>
</div>
<div>
<p>占位符</p>
<p><img src="./images/3.jpg"/></p>
</div>
<div>
<p>占位符</p>
<p><img src="./images/3.jpg"/></p>
</div>
<div>
<p>占位符</p>
<p><img src="./images/3.jpg"/></p>
</div>