视差原理:在滚动的时候,内容和多层次的背景实现或不同速度或不同方向的运动
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
div{
width: 100%;
height: 500px;
}
div:first-child{
background: url("images/1.jpg") no-repeat center /cover;
}
div:last-child{
background: url("images/2.jpg") no-repeat center /cover;
/*背景图片定位 scroll:随滚动条滚动而滚动*/
background-attachment: fixed;
}
</style>
</head>
<body>
<div></div>
<div></div>
</body>
</html>
切割轮播图
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<ti