I found two CSS scroll-snaps examples from csstricks.com. However, one of them does not work on Chrome on Windows.
- Example #0 - works
- Example #3 - does not work
What is the difference between the two examples? Why does one of them work, and not the other?
Example 1:
.container {
flex-basis: 50%;
max-height: 100vh;
overflow-y: scroll;
border: 1px solid gray;
scroll-snap-type: y mandatory;
&.proximity {
scroll-snap-type: y proximity;
}
}
li {
border-bottom: 1px solid white;
padding: 3rem;
font-size: 1.4rem;
color: rgba(white, .5);
background: lightgray;
text-align: center;
scroll-snap-align: start;
display: flex;
flex-flow: column;
justify-content: center;
}
Example 2:
body {
font-family: sans-serif;
scroll-snap-type: mandatory;
scroll-snap-points-y: repeat(100vh);
scroll-snap-type: y mandatory;
}
section {
border-bottom: 1px solid white;
padding: 1rem;
height: 100vh;
scroll-snap-align: start;
text-align: center;
position: relative;
}
Edit: Thanks to Kaiido for solving this issue. As a I suspected it also solved the problem I had on a project I have been working on. I have sent an email to csstricks.com to notify them about the bug.