2 ms·
That's a good way to do it personally, and I might start taking that approach too. The Tailwind syntax for some of the more complex stuff is appalling.
by satvikpendem 4y ago
That's a good way to do it personally, and I might start taking that approach too. The Tailwind syntax for some of the more complex stuff is appalling.
- frosted-flakes 4y agoOne of my most-used utility class is "reset". Default styles are great, but they often get in the way, so I'll throw this on an element whenever I want to start from a blank slate, alongside other utility classes or a custom class. This can significantly cut down on the length of my CSS files, as well as make them much less brittle and less dependent on the HTML structure, because I don't need to repeatedly undo default styles in every rule I write. My scoped CSS files are typically under 100 lines, even for somewhat complicated things. .reset { display: inline; appearance: none; font: inherit; border: none; border-radius: 0; margin: 0; padding: 0; color: inherit; background: none; list-style: none; text-align: inherit; user-select: inherit; } This is defined first in my CSS index file, so that any other classes will override it. (Note that there's probably a better way of writing this rule. This is just something that evolved organically.)
- kaba0 4y agoThat’s pretty much what tailwind does without any boilerplate.
- frosted-flakes 4y agoNo, Tailwind erases pretty much all browser styles automatically. I use my "reset" class far more selectively, and there's no boilerplate involved.