Jump to content

CSS animations: targeting a different element


Recommended Posts

Only if id="b" is sibling to id="a"


#A:hover + #B {...}


<div id="A">ggggg</div>

<div id="B">ggggg</div>



#A:hover ~ #B {...} this shouuld work but test first


<div id="A">ggggg</div>

<div id="Aa">ggggg</div>

<div id="B">ggggg</div>


this won't work


<div id="A">ggggg</div>


<div id="Aa">ggggg

<div id="B">ggggg</div>



as now "B" is child of "Aa" and so is not a sibling element to "A" any longer, but "Aa" is a sibling to "A".

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...