Skip to content

Instantly share code, notes, and snippets.

@susanahernandezd
Last active January 21, 2022 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save susanahernandezd/20e5684f2917e33b4d8066f783d57c15 to your computer and use it in GitHub Desktop.
Save susanahernandezd/20e5684f2917e33b4d8066f783d57c15 to your computer and use it in GitHub Desktop.
.nav-mobile-scroll {
/*
[1]: All items a forced onto a single line, causing the overflow when necessary.
[2]: Automatic overflow means a scroll bar won’t be present if it isn’t needed
[3]: Make it smooth scrolling on iOS devices before
[4]: Hide the ugly scrollbars in Edge until the scrollable area is hovered
[5]: Hide the scroll bar in WebKit browsers
*/
white-space: nowrap; /* [1] */
overflow-x: auto; /* [2] */
-webkit-overflow-scrolling: touch; /* [3] */
-ms-overflow-style: -ms-autohiding-scrollbar; /* [4] */
scroll-snap-type: x mandatory;
scroll-behavior: smooth;
overflow: -moz-scrollbars-none;
scrollbar-width: none;
ms-overflow-style: none;
scroll-padding-left: 1rem;
&>* {
scroll-snap-align: start;
scroll-snap-stop: always;
}
/* [5] */
&::-webkit-scrollbar {
display: none;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment