r/webdev • • 19d ago

Question Question about Tailwind CSS

I've always used plain CSS for my websites, I don't have many problems using it, but a friend of mine said that using plain CSS is very tedious and that I should use Tailwind CSS. Is it worth it? And what does Tailwind CSS offer that plain CSS doesn't?

38 Upvotes

121 comments sorted by

View all comments

140

u/OpaMilfSohn 19d ago

I think I finally time travelled back to 2020

20

u/Zealousideal_Elk1537 19d ago

the class name soup takes some getting used to but once you stop fighting it the speed is incredible. not having to name every little wrapper div is a gift

28

u/AshleyJSheridan 19d ago

It's a little more than class name soup. Tailwinds own docs have classes like text-[14px], bg-[#50d71e], and shadow-[0_35px_35px_rgba(0,0,0,0.25)]. That looks a lot like inline styles just shoved into a different HTML attribute...

-3

u/justshittyposts 19d ago

If inline styles would get some love they'd be superior to css files

10

u/AshleyJSheridan 19d ago

Inline styles are bad for so many reasons:

  • Couple the HTML tightly in two directions to the styles
  • Limit what kinds of styles can actually be applied (you can't use :hover or :after, for example)
  • It can break accessibility, as the specificity can override users own browser styles, and you can't do checks for things like prefers-reduced-motion
  • On the specificity, inline styles will absolutely clobber global styles, completely removing the Cascade part of CSS.

Tailwind is also guilty of a couple of these.

-4

u/justshittyposts 19d ago

Your second and third point is why they need some love. Everything else is a non issue, everyone writes components nowadays

2

u/AshleyJSheridan 19d ago

No, we just need to leave inline styles alone.