3 ms·
Author here — a common question I’ve seen in the comments that I didn’t cover in the article is how you do responsive design with this approach. Here’s a link
by adamwathan 7y ago
Author here — a common question I’ve seen in the comments that I didn’t cover in the article is how you do responsive design with this approach.
Here’s a link to the responsive design guide in the Tailwind CSS docs that covers it in detail:
https://tailwindcss.com/docs/responsive-design https://tailwindcss.com/docs/responsive-design
The TL;DR is you have breakpoint-specific versions of your utilities, so you can define all of your responsive behaviour directly in your markup.
For example this element would be `block` by default (on mobile) and `flex` when the browser is at or above some defined “medium” breakpoint:
<div class=“block md:flex”>
Two years after writing that article I can say CSS definitely feels “solved” to me, and every time I have to go back to an old Tailwind project it’s very easy to make changes.
If you’re building things with React, I’d also encourage you to explore projects like Emotion and Theme UI which allow you to work with the same philosophical approach (styling elements directly instead of through “hooks” and some separate style layer) but with a bunch of neat advantages that aren’t possible with a regular class/CSS-based API, like having better control over how style definitions override each other when applied to the same element.
Personally I’m still very happy using Tailwind even in React projects, because the syntax is more terse and it’s nice to have a singular styling paradigm that I can use even outside React projects.
- 38932ur98u 7y agoThanks for the fantastic library! I've really enjoyed using it and it has sped up dev time phenomenally. However, I am curious: what is it like using tailwind on huge projects? I can imagine with many developers working on a codebase the "extract repeated patterns to their own new class" philosophy can get easily ignored, or difficult to track where some series of classes is being repeated.