Skip to content

Instantly share code, notes, and snippets.

@Sandstedt
Last active October 1, 2020 06:49
Show Gist options
  • Save Sandstedt/6b15a78ac8767e7e5df42bb8e64f5c59 to your computer and use it in GitHub Desktop.
Save Sandstedt/6b15a78ac8767e7e5df42bb8e64f5c59 to your computer and use it in GitHub Desktop.
A native CSS adoptation of smooth scroll js libraries
/* Activate a smooth scroll whn using inline anchor links, example: #about */
html {
scroll-behavior: smooth;
}
/* Deactivate the smooth scroll if users has choose to reduce motion in their OS */
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment