Tailwind Responsive Classes Not Working on Mobile
Your Tailwind responsive classes (md:, lg:, sm:) don't apply correctly on mobile devices. Layout breaks on specific screen sizes or doesn't adapt to viewport changes.
Responsive breakpoints fail when viewport meta tag is missing, Tailwind configuration is incomplete, or browser caching prevents style updates.
Error Messages You Might See
Common Causes
- Missing or incorrect viewport meta tag in HTML head
- Tailwind content config doesn't match file locations containing responsive classes
- Browser caching old CSS before responsive classes were added
- Responsive classes written incorrectly (e.g., md:w-50 instead of md:w-1/2)
- Mobile viewport width detection failing due to viewport settings
How to Fix It
Add viewport meta tag: In next/head or layout, ensure: <meta name="viewport" content="width=device-width, initial-scale=1" />
Clear build cache: Delete .next folder and rebuild: rm -rf .next && npm run dev
Test with DevTools: Use Chrome DevTools device emulation (Ctrl+Shift+M) to verify responsive behavior.
Valid breakpoint sizes: Use Tailwind defaults: sm (640px), md (768px), lg (1024px), xl (1280px), 2xl (1536px).
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get HelpFrequently Asked Questions
What's the mobile-first approach in Tailwind?
Tailwind uses mobile-first: base styles apply to all sizes, then md: and lg: override for larger screens. Don't use sm: unless targeting very small devices.
How do I test responsive design?
Use Chrome DevTools (F12), toggle device toolbar (Ctrl+Shift+M), and test different screen sizes. Also test on real devices.
Can I customize Tailwind breakpoints?
Yes, in tailwind.config.ts: theme: { extend: { screens: { 'custom': '992px' } } }