css 吸顶 复制可用
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>吸顶</title>
<style type="text/css">
.box{
box-sizing: border-box;
height: 150px;
border:solid 3px black;
margin: 0 0 20px 0;
overflow: auto;
}
.block{
width: 50px;
height: 50px;
background-color: orange;
}
.sticky-1{
position:sticky;
top: 0px;
}
</style>
</head>
<body>
<div class="box box-1">
<p>下面这个小黄块设置为sticky</p>
<div class="sticky-1 block">
</div>
<p>hahah</p>
<p>hahah</p>
<p>hahaha</p>
<p>hahaha</p>
</div>
</body>
<script type="text/javascript">
</script>
</html>