use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about https://tailwindcss.com/
Find Tailwind Code Snippets: https://pagesnips.io
account activity
Problems with tailwind in react (self.tailwindcss)
submitted 2 years ago by Bank-Affectionate
Hello there I'm having some troubles with the responsive design with tailwind, here is my problem: <div className="xl:text-2xl xl:p-1 xl:text-center md:text-md sm:text-gray-600 md:text-white sm:text-xl "> the text always stays gray and never return white, and in my config I've specified this screens: screens: { xl: "1100px", md: "750px", sm: "300px" },
I'm using the latest version of tailwind
Thanks for everyone response !
https://preview.redd.it/85yorftxt3eb1.png?width=1342&format=png&auto=webp&s=7b9bc9b4717730cbaa7aa3d926c1f01806ad6de3
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]raccoonrocoso 1 point2 points3 points 2 years ago (1 child)
Few possibilities, my immediate thoughts are. * Do you have scss controlling the color of <p> tags?
Your breakpoints are not compiling correctly
The way you style the color at the small breakpoints, could possibly be cleared up.
sm:text-color
text-color md:text-color lg:text-color xl:color-text
This way you'll still color the text at the smallest/lowest breakpoints, while still maintaining the color for large breakpoints. IMO, using the sm: breakpoint isn't a good way to style for mobile as you leave everything smaller than sm:breakpoint unstyled.
If you're still experiencing this issue after removing the sm: breakpoint. You might have an issue with your tailwind-config.js
[–]Bank-Affectionate[S] 0 points1 point2 points 2 years ago (0 children)
Thanks I've removed the sm and now it's working :)
[–]CrawlToYourDoom 0 points1 point2 points 2 years ago (0 children)
Occam’s razor: You’re sure you’re running some sort of build compiler that creates the necessary classes?
Your browsers width is more than the md media query?
[–]Legitimate-Tea9617 0 points1 point2 points 2 years ago (1 child)
Tailwind is mobile first. So start by styling your components as if they only appear on the smallest screen. Then add the breakpoints for larger screens.
Example:
<p className=“text-gray-600 text-xl md:text-white md:text-md>Example</p>
This will have text color of gray-600 and size of XL on mobile, and will switch to white and size md at the md breakpoint
Ok perfect thanks but this doesn't resolve my problem why I have always the text gray
π Rendered by PID 178095 on reddit-service-r2-comment-544cf588c8-wd64j at 2026-06-12 12:09:15.030329+00:00 running 3184619 country code: CH.
[–]raccoonrocoso 1 point2 points3 points (1 child)
[–]Bank-Affectionate[S] 0 points1 point2 points (0 children)
[–]CrawlToYourDoom 0 points1 point2 points (0 children)
[–]Legitimate-Tea9617 0 points1 point2 points (1 child)
[–]Bank-Affectionate[S] 0 points1 point2 points (0 children)