Skip to content

Instantly share code, notes, and snippets.

@dbugshe2
Created August 28, 2022 18:40
Show Gist options
  • Save dbugshe2/7f4d48a3f0400c99c36f13d000560cc8 to your computer and use it in GitHub Desktop.
Save dbugshe2/7f4d48a3f0400c99c36f13d000560cc8 to your computer and use it in GitHub Desktop.
A tailwind plugin to hide those pesky overflow scrollbars
const plugin = require('tailwindcss/plugin')
const scrollbarHide = plugin(function ({ addUtilities }) {
addUtilities({
'.scrollbar-hide': {
/* IE and Edge */
'-ms-overflow-style': 'none',
/* Firefox */
'scrollbar-width': 'none',
/* Safari and Chrome */
'&::-webkit-scrollbar': {
display: 'none'
}
},
'.scrollbar-default': {
/* IE and Edge */
'-ms-overflow-style': 'auto',
/* Firefox */
'scrollbar-width': 'auto',
/* Safari and Chrome */
'&::-webkit-scrollbar': {
display: 'block'
}
}
}, ['responsive'])
})
module.exports = scrollbarHide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment