How to Hide Scrollbars in Tailwind Without Custom Classes or @layer? #16744
Answered
by
wongjn
MonaAghili
asked this question in
Help
-
We are using Tailwind CSS in a library and need to remove the default browser scrollbar using the following styles: .hide-scrollbar {
-ms-overflow-style: none; /* Internet Explorer 10+ */
scrollbar-width: none; /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar {
display: none; /* Safari and Chrome */
} However, since we are working within a library, we cannot add custom classes or use Is there a way to apply these styles directly to the HTML or elements without relying on custom classes or modifying Tailwind’s configuration? |
Beta Was this translation helpful? Give feedback.
Answered by
wongjn
Feb 22, 2025
Replies: 1 comment 1 reply
-
Yep: <div class="[scrollbar-width:none] [&::-webkit-scrollbar]:hidden"> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
MonaAghili
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yep: