4 ms·
There is a great Hacker News comment from this year out there somewhere explaining exactly where the complexity in CSS comes from, if only I can find it again.
by icpmacdo 3y ago
There is a great Hacker News comment from this year out there somewhere explaining exactly where the complexity in CSS comes from, if only I can find it again.
- davnicwil 3y agounanticipated usecases?
- throwaway14356 3y agoi bet it has interesting and insightful comments
- rendall 3y agoIs it that CSS is complicated because the problem it solves is complicated?
- sidlls 3y agoThe problem of layout is not nearly as complicated as the spaghetti mess of code presented in this article implies.
- wruza 3y agoIsn’t it self-imposed complexity most of the time?
- rendall 3y agoNot sure what you mean. The problem set of machine layout across devices and designs is vast and complicated. There are simpler solutions sets, or solutions that simplify by limiting options, but I'm a staunch defender of CSS as an adequate, even elegant, solution to the entire problem. Again, I believe that CSS is complicated because the problem it attempts to solve is complicated. Every solution that is presented as simpler is simpler because it limits options.
- wruza 3y agoMargin system incompatible with boxing. Poor borders and outlines. No general classes for hierarchies because of selector overlap. Non-strict containment. Chaotic size request/allocation rules. No relative-to sizing and positioning. No scroll target margins. Resistance to add obviously popular features for decades. The main problem with css is that with all its complexity it underdelivers and so requires various, incompatible, non-reusable and fragile hacks to make it work. You didn’t mention specific features, but I assume it’s media queries. That’s unrelated, css is broken at its core. Every solution that is presented as simpler is simpler because it limits options. Every other layout solution I’ve used had infinite options due to trivial programmability on top of basic functionality, which wasn’t as poor as css’s and was closer to “get job done” because it was made for it and not as an afterthought. Anticipating “but they can’t wrap at width breaks!”. Yes, these were never targeted at low-width portrait screens, but that’s not the point. Css sucks long before the “responsive” keyword hits requirements.
- rendall 3y agoSorry, I don't understand your criticisms. "Margin system incompatible with boxing"? "Non-strict containment"?
- sidlls 3y agoNo, layout is not trivial. However, the approach CSS has taken to solving it is unnecessarily complicated compared to the complexity of the problem. It is without a doubt the most complicated, worst system I've ever seen for layout. Once upon a time I was writing GUI apps using Xt and Motif: that made more sense than CSS does.
- rendall 3y agoHmm. I once felt that way, but changed my mind after I dug in and really learned it on its own terms.