Created
April 29, 2020 02:17
-
-
Save amrsmind/782663df47cfce29c06e5cab157aabad to your computer and use it in GitHub Desktop.
scroll-snap-type scroll-snap-align
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> | |
.container{ | |
display: flex; | |
height:500px; | |
overflow: auto; | |
flex-flow: column nowrap; | |
width: 300px; | |
scroll-snap-type: y mandatory; | |
flex: none; | |
} | |
.box{ | |
height: 500px; | |
width: 100%; | |
flex:none; | |
scroll-snap-align: center; | |
} | |
.box1{ | |
background: red; | |
} | |
.box2{ | |
background: green; | |
} | |
.box3{ | |
background: yellow; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="box box1"> | |
</div> | |
<div class="box box2"> | |
</div> | |
<div class="box box3"> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment