I have a stack of divs all on top of one another which are set to position:absolute, all contained in a container div. What I would like to do is change the background-position of #feature_1_shade when the user hovers over #feature_1_hitbox. I have tried to achieve this by using -
#feature_1_hitbox:hover #feature_1_shade {
background-position: 0 0;
}
This doesn't work. However, it DOES work if I apply it to the container div as such:
#feature_1_container:hover #feature_1_shade {
background-position: 0 0;
}
I would almost settle for this, but I need the hitbox to be a specific size, so the :hover must be applied to my hitbox div. Is there any reason why this works for one div and not another?
Here's the markup code:
<!-- container --> <div id="feature_1_container">
<!-- shade --> <div id="feature_1_shade"></div>
<!-- text and arrow --> <div id="feature_1_text_container"><h3 id="feature_1_arrow">Memberships</h3><p id="feature_1_text">Text here text here</p></div>
<!-- image --> <div id="feature_1_graphic"></div>
<!-- hitbox --> <a href="#"><div id="feature_1_hitbox"></div></a>
</div> <!-- #feature_1_container -->
Here's the CSS:
#feature_1_container {
width: 289px;
height: 255px;
float: left;
}
#feature_1_hitbox {
width: 289px;
height: 166px;
margin: 89px 0 0 0;
position: absolute;
/* background-color: #F99; */
}
#feature_1_graphic {
width: 289px;
height: 255px;
position: absolute;
background-image: url(site_style_images/feature_1_memberships_bag.png);
}
#feature_1_text_container {
width: 289px;
margin: 100px 0 0 0;
position: absolute;
}
#feature_1_text {
margin: 0 0 0 100px;
}
#feature_1_arrow {
background-image: url(site_style_images/feature_arrows.png);
background-position: center right;
background-repeat: no-repeat;
height: 49px;
padding: 0 30px 0 100px;
margin: 0 22px 0 0;
color: #8d895c;
font-size: 22px;
line-height: 44px;
font-family: 'Quicksand', sans-serif;
font-weight: normal;
letter-spacing: -2px;
font-style: normal;
}
#feature_1_shade {
width: 289px;
height: 166px;
margin: 89px 0 0 0;
background-image: url(site_style_images/feature_1_shade.png);
background-position: 0 -166px;
position: absolute;
background-color: #CCC;
}
#feature_1_hitbox:hover #feature_1_shade {
background-position: 0 0;
}