Created
November 13, 2019 19:32
-
-
Save davidmwhynot/0cfbd4fb1450aec00c145614c7d020c7 to your computer and use it in GitHub Desktop.
sass scrollbar mixin
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
/// Mixin to customize scrollbars | |
/// Beware, this does not work in all browsers | |
/// @author Hugo Giraudel | |
/// @param {Length} $size - Horizontal scrollbar's height and vertical scrollbar's width | |
/// @param {Color} $foreground-color - Scrollbar's color | |
/// @param {Color} $background-color [mix($foreground-color, white, 50%)] - Scrollbar's color | |
/// @example scss - Scrollbar styling | |
/// @include scrollbars(.5em, slategray); | |
@mixin scrollbars($size, $foreground-color, $background-color: mix($foreground-color, white, 50%)) { | |
// For Google Chrome | |
::-webkit-scrollbar { | |
width: $size; | |
height: $size; | |
} | |
::-webkit-scrollbar-thumb { | |
background: $foreground-color; | |
border-radius: $size / 2; | |
} | |
::-webkit-scrollbar-track { | |
background: $background-color; | |
} | |
// For Internet Explorer | |
body { | |
scrollbar-face-color: $foreground-color; | |
scrollbar-track-color: $background-color; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment