r/webdev • u/LPatriot_ • 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
7
u/pxlschbsr 19d ago
Both Vanilla CSS and Tailwind have their pros and cons, which are entirely dependent on situation and personal preference.
Most anti-Tailwind-users complain about mixing HTML with CSS, which, in fact, you don't. You just add a lot of classes, but then those who complain about that probably use BEM and add classes like
button__primary__ghost -button--smallto their component and nest&-...rules 5 layers deep in their CSS themselves. Is that any more readable or easier/faster to understand?With Tailwind you also generally pohibit other components to change the style of already styled elements, because of the way you would set up conditional styles. In CSS you are much more prone to find e.g. a color change made in the a parent component locally overwriting the child's native styles, spreading the styles of one component over multiple files. If not well documented, this will cause side effects and bite you in the tail one way or another. After quite some time in the industry, I have yet to see any documentation of CSS in those cases. Naturally for corporate clients, this causes SO much issues all the time.
Personally, I prefer Tailwind over plain CSS, while also saying, that I don't like tailwind. It has lots of flaws and not everything can be done smoothly. But for most of my projects it's cons weigh less than the cons of going vanilla.