x
 
<!DOCTYPE html>
<html>
<head>
<style>
#container {
  position: relative;
  width: 80%;
  aspect-ratio: 3/1;
  margin: auto;
  border: solid black 2px;
  overflow-x: hidden;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
}
.blue {
  background-color: lightblue;
  width: 95%;
  aspect-ratio: 3/1;
}
.green {
  background-color: lightgreen;
  width: 80%;
  aspect-ratio: 4/1;
}
.blue, .green {
  margin: 2px;
  scroll-snap-align: end;
  scroll-margin-bottom: 20px;
}
</style>
</head>
<body>
<h1>CSS scroll-margin-bottom 属性</h1>
<p>scroll-margin-bottom 属性设置于子元素上,以便底部吸附位置相对于容器偏移一定的距离。</p>
<div id="container">
  <div class="blue"></div>
  <div class="green"></div>
  <div class="blue"></div>
  <div class="green"></div>
  <div class="blue"></div>
  <div class="green"></div>
  <div class="blue"></div>
</div>
</body>
</html>