19 ms·
A margin is contextual, so a reusable component shouldn't have them. It's a shame that CSS doesn't allow the parent element to define how spacing around the ch
by underwater 5y ago
A margin is contextual, so a reusable component shouldn't have them.
It's a shame that CSS doesn't allow the parent element to define how spacing around the child elements should work.
- necovek 5y agoI thought you could do that with eg. parent > * { ... } There might be things missing to achieve whatever result you desire, but CSS does allow a parent element to define how spacing (and any other styling) works for child elements.
- 5560675260 5y agoWe can do this now with flexbox and grid. Spacer component from the article can be implemented with https://developer.mozilla.org/en-US/docs/Web/CSS/gap https://developer.mozilla.org/en-US/docs/Web/CSS/gap
- eyelidlessness 5y ago> It's a shame that CSS doesn't allow the parent element to define how spacing around the child elements should work. It really would be a shame if CSS didn’t have child selectors, and if they weren’t more specific than bare selectors.
- spaniard89277 5y agoYou can do it with selectors, also with flexbox and the gap property.