3 ms·
If we're being a little reductive, it's an optimized way to do inline styles for component based architectures, because it turns out inline-styles are actually
by ehnto 5y ago
If we're being a little reductive, it's an optimized way to do inline styles for component based architectures, because it turns out inline-styles are actually a pretty good way to style re-usable components. I think that's the major practical difference that might prompt such a philosophy change.
In the more traditional method, you would style a <button> element in a CSS file and never think about it again, while it inevitably becomes part of the CSS nest. If you wanted to use tailwind for a normal non-component based site you'd have to individually style every single button again and again, as there's no cascading and no globally applied styles. I wouldn't use tailwind in that cirucmstance.
But because it's more likely you're using vue/react and your buttons are actually defined as a <Button> component that you re-use, you can write the styles directly on the component where it's used, co-locating the code and making maintenance a bit easier in the process.
- pcr910303 5y ago> it's an optimized way to do inline styles for component based architectures, because it turns out inline-styles are actually a pretty good way to style re-usable components Yeah, I also understand Tailwind as inline-styles without it's problems: * it provides less choices (instead of 256*3 colors you have limited choices) * classes are (a lot) faster than inline styles in most browsers * has access to features that inline styles can't (e.g. media queries)