I work with boxes and I want to always give the last element a "margin-bottom: 0". So first I give every element a "margin-bottom: 1em;". I now want to delete this margin bottom from the last element in my boxes but if there is an element within it doesn't work and I still have a margin at the bottom. any idea how to do this? It could be a paragraph or a DIV or SPAN or whatever, so I do not always want to do this by hand. I want to make a mixin wth this.
I tried:
section *+:last-child {
margin-bottom: 0;
border: 3px solid blue;
}
But in the last div there is a paragraph with margin so it doesn't work.
You want to use :not(). That is,
section:not(:last-child) { margin-bottom:1em; }
My syntax might be wrong for what you're doing but that's a start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With