Re:They Say: Do Not Use Margins in CSS. How I Use Them Anyway
by 10x-dev on Friday January 14, 2022 @08:40PM
(#29942766)
This css selector looks like it would be slow, which, if true, would be one reason not to use it.
Re:They Say: Do Not Use Margins in CSS. How I Use Them Anyway
by gherkinnn on Saturday January 15, 2022 @12:49AM
(#29943922)
The difference in selector speed is negligible. Choosing minimal perf gains over greatly improved ergonomics is pain.
It was last an issue with IE7 and 8 [0], an era we don’t like to talk about.
0 - https://web.archive.org/web/20130508170505/https://developer...
Re:They Say: Do Not Use Margins in CSS. How I Use Them Anyway
by eurasiantiger on Saturday January 15, 2022 @02:55AM
(#29944613)
Did you just call eliminating quadratic behaviour a negligible gain in the context of graphics rendering?
I’m pretty sure you’re wrong there.
Are they in container.css, in which case container knows of .reusable-component.
Or does reusableComponent.css know about each and every possible container?
Will there be a containerPlusComponentCombo.css that juggles common rules?
The problem remains even if you prefer grouping css rules in one large file over many small files. You end up tying yourself in to knots as either parent or child requires knowledge of the other.
Sometimes it is perfectly valid. But it is not truly reusable. It doesn’t scale well and requires unnecessary mental overhead.
Instead, why not build a layout container that works for everything?
(Use the new-ish gap rule if you like, but I forgot the details and I’m tired)It is just as semantic (whatever that means) as in the article and doesn’t needlessly couple things together.