Hacker News new | ask | show | jobs
by emmacharp 1173 days ago
The naming of every little thing in CSS is what I call a "pseudo-problem" in the original post.

You don't have to name classes for everything inside a component. You only have to name the component, as in Tailwind. Afterwards, tag selection is totally fine. And with all the new CSS pseudo-selectors it is now easier than ever to be styling with low specifity while including markup options.

1 comments

If you don’t name it then it’s sensitive to DOM changes which can look completely inert in the file in which they occur.

Have you actually used Tailwind for a week or more?

Yes I have. For a couple of years and my team still uses it.

But Tailwind is sensitive to DOM changes too, since every style is on tag. You wouldn't remove any tag without understanding its usage in a component using Tailwind. Why would you treat a CSS component any other way? If a tag's there, it must be used for something. Again, I may miss something but I see that as normal care and dilligence in both ways.

On a sidenote it's now easy to include, for example, all headings to be styled the same in a component, thereby limiting the need to adjust the CSS in case of a change of tag. There are many ways now to leave markup options opened if need be.