Live data from Hacker News

Mistakes in the Design of CSS (2013)

wiki.csswg.org

121–130 of 147 posts

Re: Mistakes in the Design of CSS (2013)

#121
post #118
post #94

Earlier quoted context omitted.

Whoa, that's weird. So once there is `!important`, the order of precedence flips? I'm sure there was a good reason for that...

Your OS had a dark theme, that gets represented in the browser as a not !important user style. The website should be able to override this to avoid the white text on white background problem. But then if the user is tweaking a specific site, the user should be able to override anything with ! important if they really mean it.

Yeah, I understand that in general.

But what's curious is that normally it goes browser user > author. Specifically the part where the browser now outranks the user style is interesting.

Re: Mistakes in the Design of CSS (2013)

#122
post #112

Make flexbox the default layout for everything, and add a flex-snap feature that will snap to the nearest multiple of some given size. I'm not sure we actually would still need grids. I also wonder if you couldn't have a more transparent and parameterizable auto width algorithm based on a lowest cost solver. So you could say "If this element wraps, it's cost 50", meaning you want all the boxes to stay on as few lines…

I like this idea. Would that impact performance negatively?

Looks like someone actually tested it, flex is a bit slower but not terribly slower. https://stackoverflow.com/questions/39463220/does-deep-nesti...

I'm guessing the solver engine would need lots of work to optimize, but I've never implemented that kind of thing so I don't quite know. I'm not even sure what kind of library could handle it. Something like OptaPlanner?

Re: Mistakes in the Design of CSS (2013)

#123
post #27
post #9

> background-position and border-spacing (all 2-axis properties) should take vertical first, to match with the 4-direction properties like margin. I hate that margin / padding short-hands, especially with 2 values, expect vertical first. In my head it's always (x,y) and (width,height) – always horizontal then vertical, I feel like it works like this everywhere else? Now my issue is that I've committed to memory that…

North East South West (never eat sour worms) not East South West North

If you're Australian, you may have heard "Never Eat Soggy Weetbix" instead, very fun.

Re: Mistakes in the Design of CSS (2013)

#124
post #113
post #76

Earlier quoted context omitted.

How would your flex box solution handle a simple two column layout where the first column is a variable size? There isn’t a fixed multiple to “snap” to.

Maybe add `flex: 1` to the second column?

The second column can't always just be a tall column shaped div, because you probably want to reflow 12, 34, 56, 78 on mobile where you don't have room for 2 columns, to something like 12345678, not 13572468

Re: Mistakes in the Design of CSS (2013)

#125

The list reminds me of when people refactor code and then just rename things. Ok, foo should've been called bar, but is that really a design mistake? The biggest design mistake for me is that it contains the letter C - it never should've been cascading. There's probably a need to resolve conflicting rules but it never should've been THE feature around which the language is designed. The precedence algorithm, the spec…

Tailwind-style selectorless approach is essentially a shorter form of inline style attributes. Surely there are better solutions?

Yes, I don't understand the modern trend towards utility classes. I wonder if many of the people who reinvent them were not around when HTML 4 was the markup language of the day and the tag reigned supreme.

Re: Mistakes in the Design of CSS (2013)

#126
No, the biggest mistake in the design of CSS is not realizing they are designing a programming language, and consequently not adding means for abstraction and composition. Less, Sass, Tailwind etc. would not exist if abstraction and composition existed in CSS. This list is just a layer of paint.

Re: Mistakes in the Design of CSS (2013)

#127

The list reminds me of when people refactor code and then just rename things. Ok, foo should've been called bar, but is that really a design mistake? The biggest design mistake for me is that it contains the letter C - it never should've been cascading. There's probably a need to resolve conflicting rules but it never should've been THE feature around which the language is designed. The precedence algorithm, the spec…

Interesting to think about the implications of a non-cascading system.

First that comes to mind, is how in OOP we have this idea of "composition over inheritance". Would composable style sheets be better? IDK.

Second issue I see is that, by all definitions, browsers come with a default style. What would "No style" even be? Invisible? Or maybe a very basic default? And would that be readable at all? And how do we the override these defaults? Would the existence of any custom styles immediately disable any base styles?

Lots of issues that are mostly "solved" with cascading. But which would need (a) solution(s) without cascading.

I still like exploring the idea, but the more I dive down that rabbit hole, the more I think that actually cascading is a rather elegant solution.

And, as with OOP inheritance, it's up to us to keep it sane. I've always managed to keep my cascading max three levels: browser, basis.css, custom.css. and in neither basis nor custom, do I have inheritance (cascading) chains.

I've even used a Linter to enforce this, years ago. Cannot find it anymore, sadly.

Re: Mistakes in the Design of CSS (2013)

#128

No, the biggest mistake in the design of CSS is not realizing they are designing a programming language, and consequently not adding means for abstraction and composition. Less, Sass, Tailwind etc. would not exist if abstraction and composition existed in CSS. This list is just a layer of paint.

I disagree. No one needed that in the 90s when CSS came out, all they needed was a way to reference document styles from one file, rather than adding it manually to every HTML file.

And besides, don't all front-end frameworks just add CSS directives into the HTML anyway? I feel like the incessant urge to make webdev look and feel like pure programming that emerged with the SV gold rush would have led us where we are anyway - except in the universe where CSS was already a full fledged programming language, things would just be exponentially more complex than they are now.

Re: Mistakes in the Design of CSS (2013)

#129
Personally, I think box-sizing being content-box by default was probably the biggest misstep here, and something that genuinely feels at odds with how 99% of the population would design or build something. The fact IE got it right initially and then it took another few years to even get things fixed across the board just feels utterly ridiculous to me.

Also, not having something like Flexbox or Grid earlier on was another mistake that should have been listed too. The fact we had to resort to hacks related to floats and table layout to create basic layouts was an absolute joke, and indicates that the creators at the time had no idea what a site or application would usually be like design or functionality wise.

Re: Mistakes in the Design of CSS (2013)

#130
post #3

The Entire front end web stack looks like a design mistake. Backend looks better only because of the flexibility. You can do anything in the back. But the front you're locked into multi decade old tech and the decade old wrappers written around it.

I disagree. First of all, all of computing is locked into decades-only technology: assembler language and machine instructions. Everything comes down to that whether you write front or back end and regardless of what other "tech" is in the middle. Today, we can do anything on the front end. Some of the most popular and complex apps in history are front end apps made with JS/HTML and web components (Discord, Spotify,…

Lol, do you really consider a music player and a chat application as the most complex apps in history?
Post reply on HN