Skip to content

Instantly share code, notes, and snippets.

@pandauxstudio
Last active December 21, 2022 15:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pandauxstudio/d91860cbdfc2d12526ce04f8c4eb829b to your computer and use it in GitHub Desktop.
Save pandauxstudio/d91860cbdfc2d12526ce04f8c4eb829b to your computer and use it in GitHub Desktop.
Sass mixin to hide scrollbar in Chrome, Firefox, Safari and IE.
@mixin hideScrollbar {
// https://blogs.msdn.microsoft.com/kurlak/2013/11/03/hiding-vertical-scrollbars-with-pure-css-in-chrome-ie-6-firefox-opera-and-safari/
// There is a CSS rule that can hide scrollbars in Webkit-based browsers (Chrome and Safari).
&::-webkit-scrollbar {
width: 0 !important
}
// There is a CSS rule that can hide scrollbars in IE 10+.
-ms-overflow-style: none;
// Use -ms-autohiding-scrollbar if you wish to display on hover.
// -ms-overflow-style: -ms-autohiding-scrollbar;
// There used to be a CSS rule that could hide scrollbars in Firefox, but it has since been deprecated.
scrollbar-width: none;
}
@PrashantSinghal619
Copy link

PrashantSinghal619 commented May 6, 2021

How about placing a height: 0 !important; rule as well to hide horizontal scrollbar as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment