Skip to content

Instantly share code, notes, and snippets.

@audunolsen
Created November 20, 2023 22:48
Show Gist options
  • Save audunolsen/238bd040ce88ad21fda71037ad848e5c to your computer and use it in GitHub Desktop.
Save audunolsen/238bd040ce88ad21fda71037ad848e5c to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html, body {
height: 100%;
min-height: 100%;
border: 2px solid red;
margin: 0;
padding: 0;
overflow: hidden;
}
* {
box-sizing: border-box;
}
section {
width: 100%;
height: 100%;
font-size: 50px;
flex-shrink: 0;
display: flex;
justify-content: center;
align-items: center;
scroll-snap-align: start;
}
#wrapper {
display: flex;
overflow: scroll;
flex-direction: column;
width: 100%;
height: 100%;
scroll-snap-type: y mandatory;
}
#section-1 {
background: pink;
}
#section-2 {
background: goldenrod
}
#section-3 {
background:seagreen
}
</style>
</head>
<body>
<div id="wrapper">
<section id="section-1">1</section>
<section id="section-2">2</section>
<section id="section-3">3</section>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment