bell notificationshomepageloginedit profileclubsdmBox

10% popularity   0 Reactions

Okay, I kind of found an answer (for this case at least) myself. The key was to walk away from the margin-bottom and look at it the other way around. So first deleting the margin-bottom from p.line and then putting a margin-top on any element that follows the p.line. And then putting the margin-top to "0" on all p.lines that are preceded by another p.line.

That still won't erase the margin from the first p.text but it at least keeps the same classes together and separates to the next different element/class

css

p {
margin-bottom:1em;
}
p.line {
margin-bottom: 0;
}
p.line + *{
margin-top:1.5em;
}
p.line + p.line {
margin-top: 0em;
}

html

<p class="text">text</p>
<p class="line">___</p>
<p class="line">___</p>
<p class="line">___</p>
<p class="text">text</p>

jsfiddle.net/xtmo95ru/


Free books android app tbrJar TBR JAR Read Free books online gutenberg


Load Full (0)

Login to follow story

More posts by @Gary

0 Comments

Sorted by latest first Latest Oldest Best

 

Back to top