DEV Community

Discussion on: tailwindcss + flexbox = CSS Nirvana - Part 1

Collapse
 
mauro_codes profile image
Mauro Garcia

The secret of tailwindcss is that you'll think that it is a really bad idea until you start using it. About using the style attribute, is super different. Here are some reasons:

  • With inline styles, you can't build responsive components using breakpoints as I did on this post. You'll end up writing media queries. With tailwind, you won't write media queries again.
  • With inline styles, you can't apply styles for hover, focus, etc. But with tailwind, you can. Example: "bg-red-600 hover:bg-red-500". That's all you need to add a hover effect on your button. And you did it in two seconds without leaving your HTML file.
  • When you use tailwind, you are working with some constraints. For example: when you need to apply padding, you can't choose any number. There is a set of defined values (that can be extended very easily). This sounds like a limitation but is the opposite.

But again, give it a try and you will thank me later 😄

Collapse
 
mauro_codes profile image
Mauro Garcia

Check out this link: 2019.stateofcss.com/technologies/c...

TailwindCSS is leading the ranking both on interest and user satisfaction on 2019.

Collapse
 
alohci profile image
Nicholas Stimpson

No thanks. I'd rather keep my separation of concerns and my styling completely out of my markup. But thanks for responding.

Thread Thread
 
dakira profile image
Matthias Niess

In case you are interested in the argument for utility-first css (especially regarding separation of concerns) this article by the tailwind author really made it click for me:

The general case for utility first is nicely made in the tailwind docs:
tailwindcss.com/docs/utility-first

Collapse
 
shuhat profile image
shuhat

"The secret of tailwindcss is that you'll think that it is a really bad idea until you start using it"- completely agreed. Just a complain about flex-basis. With a bit elaborate use of flex can make tailwind significantly better.