Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Tailwind CSS hidden and visible

Backend dev here learning front. I am trying to hide an element on small and medium screens and visible on the rest of the screens.

But the thing is when I do sm:hidden it hides the element for small screens and above. And when I try to do sm:hidden md:visible the element is not visible on medium screens and above. How should I go about this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

As we can read in official docs :

By default, Tailwind uses a mobile-first breakpoint system

Then In Your case on small breakpoint hidden and visible on Large lg breakpoints and above :

<div class="hidden lg:block">
  <!-- ... -->
</div>

Example:

<!doctype html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.tailwindcss.com"></script>
</head>

<body>
  <div class="hidden lg:block">
    <h1 class="text-3xl font-bold underline">
      Hello world!
    </h1>
  </div>

</body>

</html>

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading