<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
margin: 0; | |
} | |
.group { | |
display: inline-block; | |
position: relative; | |
width: 250px; | |
height: 500px; | |
} | |
.container { | |
width: 200px; | |
height: 400px; | |
border: 12px solid black; | |
padding: 5px; | |
} | |
.box { | |
width: 160px; | |
height: 160px; | |
} | |
.sticky { | |
position: relative; | |
margin: 20px; | |
background-color: green; | |
} | |
.indicator { | |
position: absolute; | |
top: 0; | |
left: 37px; | |
background-color: red; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="group" style="top: -100px;"> | |
<div class="indicator box" style="top: 110px;"></div> | |
<div class="container"> | |
<div class="sticky box" style="top: 73px"></div> | |
</div> | |
</div> | |
<div class="group" style="top: 0"> | |
<div class="indicator box" style="top: 37px;"></div> | |
<div class="container"> | |
<div class="sticky box"></div> | |
</div> | |
</div> | |
<div class="group" style="top: 100px"> | |
<div class="indicator box" style="top: 37px;"></div> | |
<div class="container"> | |
<div class="sticky box"></div> | |
</div> | |
</div> | |
</body> | |
</html> |