Live data from Hacker News

The Rules of Margin Collapse

joshwcomeau.com

21–30 of 35 posts

Re: The Rules of Margin Collapse

#21

CSS is a testament to over-engineering.

You should try actually implementing packing, layout and size allocation algorithms sometime, if you have not.

We have our own Canvas (aka scene graph) object inside Ardour and attempting to implement all of the above there showed how delightful most of CSS is, and how necessary.

Re: The Rules of Margin Collapse

#22
post #17

I wish there would be a "lower level" language all CSS and HTML could be translated to, so both levels could have a "reasonable" formal specification...

FWIW, while there are unfortunately only very few attempts at formalizing CSS, there's at least an unofficial, unreviewed (?), partial formal semantics for (CSS 2-era) float layout based on z3 SMT and Racket you can take a look at to get a flavor, though it isn't receiving further development.

[1]: https://github.com/uwplse/cassius

[2]: https://pavpanchekha.com/blog/css-floats.html

Re: The Rules of Margin Collapse

#23
post #4

One of those things I've just been subconsciously dealing with for years without ever deciding to actually learn the rules. "Damn it collapsed. Okay padding then"

"IDK man, I just always use flexbox"

Flexbox and grids are the modern saviors of CSS. If only we had started with them.

Re: The Rules of Margin Collapse

#24
post #5

That’s because too many hedge funds and other speculators have been borrowing on margin, and that leads to collapse. Regardless of what rules are set up to regulate this, rampant speculation and bubbles can always destabilize a market and lead to collapse! You see, what happens is that capitalism rewards the greater risktakers and when the success stories have survivor bias you end up with — oh we’re talking about CS…

What do you mean this isn't a new variant of waveform collapse for procedural random generation?

Re: The Rules of Margin Collapse

#27
Nice article! As with all CSS posts there’s always something in there I’ve never used. Today it was `display: flow-root;` [1]. I’ll probably never use it given Grid and Flex but still interesting to see this may have saved some small headaches in the past.

[1] https://css-tricks.com/display-flow-root/

Re: The Rules of Margin Collapse

#28
post #17

I wish there would be a "lower level" language all CSS and HTML could be translated to, so both levels could have a "reasonable" formal specification...

That would be amazing.

It would finally allow for competition in languages/paradigms.

And we could write modern languages from scratch.

Post reply on HN