Skip to content

Instantly share code, notes, and snippets.

@maximLyakhov
Created May 27, 2022 07:58
Show Gist options
  • Save maximLyakhov/d4121cdf4cf271173d66f9f6f4c6d2f8 to your computer and use it in GitHub Desktop.
Save maximLyakhov/d4121cdf4cf271173d66f9f6f4c6d2f8 to your computer and use it in GitHub Desktop.
scrollbar styling
@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;
}
&::-webkit-scrollbar-track {
background: $background-color;
}
// For Internet Explorer
& {
scrollbar-face-color: $foreground-color;
scrollbar-track-color: $background-color;
}
}
/* Usage: */
body {
@include scrollbars(10px, pink, red);
}
.custom-area {
@include scrollbars(.5em, slategray);
}
/* https://css-tricks.com/snippets/sass/custom-scrollbars-mixin/ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment