.container
.container__inner overflow:visible(default)
.stickyBox
span position:sticky
View Compiled
body {
background: #000;
padding: 0;
}
.container {
overflow: visible scroll; //overflow-x overflow-y
max-width: 300px;
height: 90vh;
margin: auto;
background: #fff;
}
.container__inner {
height: 300vh;
}
.stickyBox {
position: sticky;
top: 0;
width: 100px;
height: 100px;
margin: 100px auto 0;
background: skyblue;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.