Tailwindcss: Hide element on mobile (sm)

Created on 10 Apr 2019  路  6Comments  路  Source: tailwindlabs/tailwindcss


Hey,

I'm unable to hide an element on mobile sm. The element should appear once the it reaches md but hidden within sm. I've tried the following:

<div class="sm:hidden md:block">
     // my content
</div>

Using the classes above, the class shows on mobile but is hidden once we reach md.

I feel like I used to be able to do this before -- was the syntax changed?

Most helpful comment

Tailwind is mobile first, sm is 576px and above (640px in v1), if you want to make it hidden below md, it should be just <div class="hidden md:block">

All 6 comments

Tailwind is mobile first, sm is 576px and above (640px in v1), if you want to make it hidden below md, it should be just <div class="hidden md:block">

Ah perfect. Thanks!

Hello,

first time that I post something under a closed issue, hope that I'm reporting in the good way.

below the code that I create for purpose

<p class="border border-solid text-center border-black md:border-red-berry">Border</p>
<p class="border border-solid text-center hidden md:block">Display</p>

the paragraph related to the change on border color, works perfectly, instead I had problem on the display paragraph. there is something wrong on my code or the display is an edge case?

Regards
Antonio

The above code does work for me as expected.
What is the intended behavior?

ps.: In the future, opening a discussion here on github or joining the tailwindcss discord would be better for questions though.

The above code does work for me as expected.
What is the intended behavior?

ps.: In the future, opening a discussion here on github or joining the tailwindcss discord would be better for questions though.

Sorry, my fault. I apologize for the inconvenience.

What should I do, if I will have questions on tailwind? I create a discussion?

Not that big of a problem but opening a new discussion is better.
https://github.com/tailwindcss/tailwindcss/discussions

Also if you use discord, tailwindcss has a server:
https://tailwindcss.com/discord

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spyric picture spyric  路  3Comments

chasegiunta picture chasegiunta  路  3Comments

ghost picture ghost  路  3Comments

divdax picture divdax  路  3Comments

paulhuisman picture paulhuisman  路  3Comments