Skip to content

Instantly share code, notes, and snippets.

@u12206050
Last active July 25, 2023 07:27
Show Gist options
  • Save u12206050/c26854b9df8b03cbf434f96216017cb6 to your computer and use it in GitHub Desktop.
Save u12206050/c26854b9df8b03cbf434f96216017cb6 to your computer and use it in GitHub Desktop.
Horizontal scroll snap container
.scroll-snap-x-container {
display:flex;
overflow-x: scroll;
-ms-overflow-style: none;
scrollbar-width: none;
-ms-scroll-snap-type: x mandatory;
scroll-snap-type: x mandatory
}
.scroll-snap-x-child {
flex-shrink: 0;
scroll-snap-align: center
}
.scroll-snap-x-container-4 {
scroll-padding: 2rem;
}
.scroll-snap-x-child--start {
scroll-snap-align: start
}
@media sm {
.scroll-snap-x-container {
display: block;
}
}
.hide-scrollbar {
-ms-overflow-style: none; /* for Internet Explorer, Edge */
scrollbar-width: none; /* for Firefox */
overflow-y: scroll;
}
.scroll-snap-x-container::-webkit-scrollbar,
.hide-scrollbar::-webkit-scrollbar
{
display: none; /* for Chrome, Safari, and Opera */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment