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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...