<article>
<section class="one">
<p>section01</p>
</section>
<section class="two">
<p>section02</p>
</section>
</article>
<article>
<section class="three">
<p>section03</p>
</section>
<section class="four">
<p>section04</p>
</section>
<section class="five">
<p>section05</p>
</section>
</article>
* {
box-sizing: border-box;
}
body {
min-height: 100vh;
margin: 0;
padding: 0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
h1 {
font-size: 20px;
color: #fff;
background: #333;
padding: 10px 15px;
margin: 0;
}
p {
font-size: 30px;
}
article {
width: 100%;
}
section {
width: 100%;
height: 100vh;
background: #fff;
display: flex;
justify-content: center;
align-items: center;
}
section.two {
background: #a0dde2;
z-index: 2;
}
section.three {
background: #e2a0b4;
z-index: 3;
}
section.four {
background: #eec496;
z-index: 4;
}
section.five {
background: #a0e2c2;
z-index: 5;
}
section {
position: sticky;
top: 0;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.