Someone was watching "The Horror Of Margins In CSS" on YT...
The Rules of Margin Collapse
31–35 of 35 posts
Re: The Rules of Margin Collapse
#32Earlier quoted context omitted.
The behavior is very obvious if you use them for text. (I have had a few cases of naively stating my margins, the browser exactly displaying what I meant, instead of what I thought I have said, and needing to understand why it worked.) Just don't use margins for layout, I guess.
It actually makes sense for laying out UI elements. Unfortunately there is no horizontal collapse.
container {
flow: horizontal; /* single row */
}
container > child {
margin:1em; /* will collapse */
}
See: https://docs.sciter.com/docs/CSS/flows-and-flexes#flowhorizo...Re: The Rules of Margin Collapse
#33CSS 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
#34Re: The Rules of Margin Collapse
#35Earlier quoted context omitted.
I put everything in tables.
I just space everything out with
I was both impressed and appalled to see it.