Jump to content
tomatoKetchup

CSS animations: targeting a different element

Recommended Posts

Hello,

 

Let's say I have 2 <div>, one wiith id=A and one with id=B

 

I want that, when hovering the mouse cursor to #A, the div #B performs an animation (let's say a transition).

 

Is that possible with CSS?

 

Thanks for reading,

 

tomatoKetchup

Share this post


Link to post
Share on other sites

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

 

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

 

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

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

 

or

#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>

</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".

Share this post


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.

Guest
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.

Loading...

×
×
  • Create New...