Breackpoint not working #2686
-
When I use the LG or XL breakpoints, the MD doesn't seem to work |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Could you create a code sample using the playground? |
Beta Was this translation helpful? Give feedback.
-
Hi @kyle-hensoon 👋 I may interpret the question the wrong way - but I think I know what you're experiencing. TL;DR: your Detailed answerTailwind 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 In other words, larger breakpoint prefixes will override values defined for smaller breakpoints.
The Hope it helps! |
Beta Was this translation helpful? Give feedback.
Hi @kyle-hensoon 👋
I may interpret the question the wrong way - but I think I know what you're experiencing.
TL;DR: your
lg
andxl
styles are overriding the ones applied inmd
, 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):
In this case, the element will be
pink
on mobile, and then progressively get overridden to becomeblue
at thesm
breakpoint and w…