I have an HTML page like this:
<p></p>
<p></p>
<p></p>
<div></div>
<p></p>
<p></p>
<p></p>
<div></div>
and this pattern continues.
Normally the div elements should not display so:
div{display:none;}
But when a paragraph is hovered, the first div element after that should be displayed:
p:hover+div{display:block;}
but this works only for the previous p
. and this:
p:hover~div{display:block;}
shows all div
s after the hovered p
not just the first one after.
How could I display only the first non-adjacent div after the hovered p
?
Actually I am looking for a selector like first-sibling
.