
: Re: css - select only when followed by specific element I have a specific problem in which I need to remove the margin-bottom of every Element that has a class only when followed by the same
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>
Free books android app tbrJar TBR JAR Read Free books online gutenberg
More posts by @Gary

: Can I factory reset a Kindle without interfering with another newer Kindle? Can you reset one kindle to factory reset, without it bothering a newer kindle? I would assume yes, because I