Jump to content

CSS Multiple Hover


ironside82

Recommended Posts

Hi there,

 

I need to get this working.

 

I have a DIV which changes colour when I hover over it, Simple.

 

However when you mouse over this DIV I need another DIV with a separate style to change also.

 

Is it possible to somehow nest another style within the hover brackets so that the other DIV also changes.

 

I hope that explains it:

 

This is DIV 1 hover:

 


#sidemenu_item:hover, {
background-color:#F1F1F1;
color:#3399CC;

}

 

And

 

This is DIV 2 -

 


#sidemenu_item_home { position:relative; float:left; width:43px; height:45px; background-image:url(images/BUTTON_home_mono.png); }

 

needs to change to:

 


#sidemenu_item_home { position:relative; float:left; width:43px; height:45px; background-image:url(images/BUTTON_home_mono); }

 

When you mouse over DIV 1

 

 

 

Thanks in advance

 

James

Link to comment
Share on other sites

You can set a hover state on child elements of the hovered element. For example:

 

<div id="parent">
  <p id="child1">Child 1</p>
  <p id="child2">Child 2</p>
</div>

 

CSS:

#parent:hover
{
  font-size:1.5em;
}
#parent:hover #child1
{
  color:red;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.