I have a generic layout component that needs to lay out its children with a vertical space between them:
.container > * + * {
margin-top: 1rem;
}
For reasons I won't go into, I can't guarantee the order the component styles are loaded in.
If a child component has had a reset to its margins applied, for example …
.child {
margin: 0
}
… and it is loaded after the .container
css, its styled will win out because a wildcard selector has no specificity, meaning both declarations are of equal weight (so the last declaration will win).
I don't want the container to know or care about what its children are (and I don't want to add a specific class to all the children).
Is there any way to increase the specificity of the first selector while leaving it generic (so it applies to any children).