3 ms·
Yeah, my bad. I realized after writing that comment that pairwise spacing is possible in CSS: p+p{margin-top:1em} h1+p{margin-top:2em} This says more
by cousin_it 7y ago
Yeah, my bad. I realized after writing that comment that pairwise spacing is possible in CSS:
p+p{margin-top:1em}
h1+p{margin-top:2em}
This says more or less directly "1em between p and p, 2em between h1 and p". The values can be changed independently, with no need for collapsing margins and so on. It's a bit unusual though.
- seanwilson 7y agoThat's the approach I use though. Spacer divs is going to lead to lots of repetition and attaching the margin to a single element always leads you to having to undo it when there's an exception later.