Hacker News new | ask | show | jobs
by lelanthran 1061 days ago
I think the real problem is that CSS mixes in two many different concerns.

If I want to create a reusable component I need to control the layout tightly, and use media queries for display size.

The user of the component needs to control the colour and cosmetic stuff, while also using media queries, but for dark/light mode.

All four use cases use the same bloody input - CSS! Which means all of the different parties are stepping on each others toes because they may accidentally set a property that needs to be set by a different party.

It's not designed for separation of concerns.

1 comments

> All four use cases use the same bloody input - CSS!

All of the four mentioned use cases are stylistic. So it is desirable to accomplish them in a domain-specific styling language.

Used correctly, conflicting regressions are greatly minified.

It's just the problem with CSS that the vast number of developers don't know about its fundamentals, such as "CSS Specifity"

https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

This collective lack of knowledge leads to the kind of "monkey patching until it works for me (and breaks for you)" many lament about.

Feel free to give an concrete minimum viable example (including code) where you are struggling with CSS, and I will try to give suggestions.

> All of the four mentioned use cases are stylistic.

I respectfully disagree.

CSS controls layout of child components within a container, which is not a stylistic use case.

I've used Qt, WxWidgets, Tk, Delphi, VB and more, and none of them treat layout as a characteristic identical in nature to (for example) background-color.

Finagling the layout manager in any UI toolkit uses a very different mechanism from specifying the colors to use.

> Used correctly, conflicting regressions are greatly minified.

Maybe. I dunno if it is reasonable that the human reader can know all the CSS styles and files, and still not be able to tell which style will eventually be applied, because all of them have a '!' somewhere. > Feel free to give an concrete minimum viable example (including code) where you are struggling with CSS, and I will try to give suggestions.

I'm not really struggling; I find it weird, that is all - I think it is a mixing of concerns when the mechanism used to specify the location of (for example) the major page elements (menubar, leftnav, maincontent, rightnav)is the same as the mechanism to specify the background-color.