Short Version: Is there a way to apply a style to an HTML element in CSS only if it is followed by another specific element?
Longer version: The situation is as follows: I am creating content using a help authoring tool (MadCap Flare). Let's say I have the following code:
<ol>
<li>First li</li>
<li>Second li</li>
</ol>
<p>A (conditional) paragraph.</p>
<ol>
<li>Third li</li>
<li>Fourth li</li>
</ol>
Let's also say the ol has a margin-bottom of 8px, while a li has a margin-bottom of 2px.
The paragraph in the middle might or might not show up in my output, depending on some condition. If the paragraph is there, the margin of the ol will apply. No problem there.
If the paragraph is not there, however, I would like the ol element to have a smaller margin - just the 2px the li-Elements have. In this case, I want it to look like there is just one list.
My dream solution would be to give the ol a margin of 2px if and only if it is followed by another ol. Is there a way to do this with CSS, or will I have to tweak this in some other way?