|
|
|
|
|
by GloomyBoots
1072 days ago
|
|
The separation of HTML, CSS, and JS doesn't make sense when you're building applications instead of very basic documents. Style, content, and behavior are all intertwined: say you have a collapsible navbar; does the toggle button (HTML) have any meaning at all separate from its behavior (JS); does a "navbar" mean anything at all without its associated style (CSS)? <nav> might have some semantic meaning, but really it's just a div with a list of anchors until you turn it into a navbar with CSS. Centralizing these nominally separate things that aren't actually separate in modern web applications makes sense. It doesn't have to be Tailwind, but Tailwind works well and is easy enough to understand in a second. The biggest downsides are that until you get the hang of it you have to look up class names a lot (although they are fairly consistent), it requires knowledge of CSS already so isn't really beginner-friendly, and it can be easy to get lazy and cause a similarly inconsistent and chaotic style soup--am I using px-2 for these kinds of things or px-4--as you might with inline styles (but Tailwind provides nice facilities to avoid this by configuring your theme and adding your own component classes--the latter might be best used sparingly and avoided through better reuse of HTML). I think most Tailwind users are using it in JS. It works just as well if you're doing everything in HTML, like with htmx or something similar, which is nice for me. |
|