Last active
January 14, 2021 22:27
-
-
Save joebailey26/04220c87afeacc2a47670a90565fc12b to your computer and use it in GitHub Desktop.
Smooth Scroll
This file contains 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
<style> | |
:root:focus-within { | |
scroll-behavior: smooth; | |
} | |
@media screen and (prefers-reduced-motion: reduce) { | |
:root:focus-within { | |
scroll-behavior: auto; | |
} | |
} | |
</style> | |
<a href="#scrolled">Scroll me</a> | |
<div tabindex="-1" id="scrolled"> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment