Skip to content

Breackpoint not working #2686

Discussion options

You must be logged in to vote

Hi @kyle-hensoon 👋

I may interpret the question the wrong way - but I think I know what you're experiencing.

TL;DR: your lg and xl styles are overriding the ones applied in md, due to the "mobile first" nature of Tailwind CSS.

Detailed answer

Tailwind styles are designed to work mobile first: styles without prefixes apply to everything, and then breakpoint prefixes override styles for larger screens.

For example, take the following code (available as a Play demo):

<div class="bg-pink-300 sm:bg-blue-300 md:bg-purple-300 lg:bg-teal-300 xl:bg-green-300">...</div>

In this case, the element will be pink on mobile, and then progressively get overridden to become blue at the sm breakpoint and w…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@PabloRiv
Comment options

@andrew-arkhipov
Comment options

Answer selected by simonswiss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #2686 on October 27, 2020 15:00.