I tried to use the Tailwind hidden
class to hide content from my page on mobile screens only, but instead it becomes hidden for desktop and visible in the mobile version. I want the opposite.
My code:
<nav class="hidden lg:block">abc</nav>
I also tried to use the visible
and invisible
utility classes, but that didn’t work at all.
2
Answers
Why don’t you just use the @media query? You can show something on desktop and hide on mobile by using this css:
You can simply use the
sm
breakpoint for mobile screens. And assign below class to that coomponent.ANd you can also view the example here