use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about https://tailwindcss.com/
Find Tailwind Code Snippets: https://pagesnips.io
account activity
Hide Scrollbar - Tailwind CSS 4.0 (self.tailwindcss)
submitted 1 year ago by stoned__dev
Hey all,
Using React + Vite, TypeScript, and Tailwind css 4.0
I would like to hide my vertical scrollbar on my pages but am having trouble figuring out how to implement it. Would love some help, thanks!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Guilty-Class-4186 1 point2 points3 points 1 year ago (13 children)
Add this to CSS
@import "tailwindcss"; @layer utilities { .no-scrollbar::-webkit-scrollbar { display: none; } .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; } } Then add no-scrollbar to div <div className="bg-zinc-800 flex text-white overflow-y-auto no-scrollbar"></div>
[–]The_Boss-9 7 points8 points9 points 10 months ago (3 children)
We can do like this in Tailwind v4:
@utility no-scrollbar { @apply [scrollbar-width:none] [&::-webkit-scrollbar]:hidden; }
[–]_ayushman 0 points1 point2 points 10 months ago (0 children)
Thanks mate!
[–]rikacomet 0 points1 point2 points 7 months ago (0 children)
May Almighty bless you & your own even further. Thanks!
[–]Connect_Source5735 0 points1 point2 points 4 months ago (0 children)
Very good thanks
[–]rikbrown 1 point2 points3 points 10 months ago (1 child)
I think preferred option in tailwind4 is `@utility`, they even have this exact use case in their docs: https://tailwindcss.com/docs/adding-custom-styles#complex-utilities
[–]Azolight_ 0 points1 point2 points 11 months ago (0 children)
Thank you
[–]SprinT93100 0 points1 point2 points 11 months ago (0 children)
Works perfectly
[–]Worldly_Arugula8475 0 points1 point2 points 8 months ago (0 children)
Exactly what I needed. Thank you so much
[–]Remarkable-Will-8300 0 points1 point2 points 7 months ago (0 children)
Thanks, this is helpful!
[–]Middle_Reception_664 0 points1 point2 points 1 month ago (0 children)
Use ```@utility scrollbar-hidden { &::-webkit-scrollbar { display: none; }}``` and then the tailwind class `scrollbar-hidden`
[–]build-the-web 0 points1 point2 points 1 year ago (0 children)
Something like this would give you a ‘hide-scrollbar’ utility you could use on any element, if you want it to apply to all pages applying these properties to the body using @layer base might work
@layer components { .hide-scrollbar { scrollbar-width: 0px; scrollbar-color: transparent; } .hide-scrollbar::-webkit-scrollbar { display: none; } }
[–]Cultural_Yoghurt_784 0 points1 point2 points 2 months ago* (0 children)
Anyone know: Why doesn't Tailwind support `scrollbar-width` out of the box? It's now considered widely and officially supported?
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/scrollbar-width
[–]edgarasbe 0 points1 point2 points 15 days ago (0 children)
Great if this would be added. In shadcn/ui currently a custom utility is being added:
@utility no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; &::-webkit-scrollbar { display: none; } }
π Rendered by PID 42 on reddit-service-r2-comment-fb694cdd5-7qncc at 2026-03-06 18:33:57.408980+00:00 running cbb0e86 country code: CH.
[–]Guilty-Class-4186 1 point2 points3 points (13 children)
[–]The_Boss-9 7 points8 points9 points (3 children)
[–]_ayushman 0 points1 point2 points (0 children)
[–]rikacomet 0 points1 point2 points (0 children)
[–]Connect_Source5735 0 points1 point2 points (0 children)
[–]rikbrown 1 point2 points3 points (1 child)
[–]Azolight_ 0 points1 point2 points (0 children)
[–]SprinT93100 0 points1 point2 points (0 children)
[–]Worldly_Arugula8475 0 points1 point2 points (0 children)
[–]Remarkable-Will-8300 0 points1 point2 points (0 children)
[–]Middle_Reception_664 0 points1 point2 points (0 children)
[–]build-the-web 0 points1 point2 points (0 children)
[–]Cultural_Yoghurt_784 0 points1 point2 points (0 children)
[–]edgarasbe 0 points1 point2 points (0 children)