4 ms·
Where are the respective styles kept? Are they in container.css, in which case container knows of .reusable-component. Or does reusableComponent.css know abou
by gherkinnn 5y ago
Where are the respective styles kept?
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?
.container > * + * {
margin-too: var(--sp-md);
}
(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.
- 10x-dev 5y agoThis css selector looks like it would be slow, which, if true, would be one reason not to use it.
- gherkinnn 5y agoThe 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://developers.google.com/speed/docs/best-practices/rendering https://web.archive.org/web/20130508170505/https://developer...
- eurasiantiger 5y agoDid you just call eliminating quadratic behaviour a negligible gain in the context of graphics rendering? I’m pretty sure you’re wrong there.