相对位置和绝对位置
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>fixed</title>
<link rel="stylesheet" href="cssLone.css">
<style>
.block{
width: 80px;
height: 80px;
line-height: 80px;
text-align: center;
border: 2px solid black;
}
.block:nth-child(1){
position:fixed ;
top:100px;
left: 20px;
}
.block:nth-child(2){
position: absolute;
top:100px;
left: 20px;
}
</style>
</head>
<body>
<div class="block"> a</div>>
<div class="block"> b</div>>
</body>
</html>
child (1)指的就是a
a是定在页面上,导致了不会随着滚条变化
child(2)指的就是b
b是会随着滚条滑动 absolute