I'm trying to achieve scroll snap using CSS. Splash, page1, page2 is how I want my HTML to snap. My CSS doesn't seem to snap, what am I doing wrong?
body{
overflow-y: scroll;
scroll-snap-type: y mandatory;
}
.splash{
scroll-snap-align: start;
width: 100vw;
height: 100vh;
}
.page1{
scroll-snap-align: start;
width: 100vw;
height: 100vh;
}
.page2{
scroll-snap-align: start;
width: 100vw;
height: 100vh;
}
<body>
<section class="splash"></section>
<section class="page1"></section>
<section class="page2"></section>
</body>
You are close, the only thing you have to add is a wrapping container with full height of the view-port and also set each section to full height of the view-port: