tags:

views:

264

answers:

2

I have the following code for a selectable tab:

<div class="tabOff">
   <div class="lightCorner TL"></div><div class="lightCorner TR"></div>
   <div class="cornerBoxInner">
      <p>My Tab</p>
    </div>
</div>

On the mouse over of tabOff I have the following CSS for changing the background colour:

.tabOff:hover
{
    background:#AAA;
    color:#CDEB8B;
}

Is there any way I can change my classes "lightCorner TL" and "lightCorner TR" to use a different background image, without JavaScript, when tabOff is hovered

This is the current CSS for lightCorner TL and TR:

.lightCorner
{
    background:url(../Images/LightCorner.gif) no-repeat;
}
.TL
{
    top:0px;
    left:0px;
    background-position:0px 0px;
}
.TR
{
    top:0px;
    right:0px;
    background-position:-13px 0px;
}
+2  A: 

I have never tried it, but I would start with:

.tabOff:hover .lightCorner {
}

Don´t know if that's correct usage though.

jeroen
That works great for a start, but I need to control the TL and TR corners separately. Thanks!
GenericTypeTea
Scrap that, got it working with your example, just replace .lightCorner with .TR!
GenericTypeTea
Well, just try it with .tabOff:hover .TR {} and .tabOff:hover .TL {}, the above was just an example.
jeroen
You just beat me to it...
jeroen
Note that earlier versions of IE don't handle :hover correctly on non-'a' elements.
Sam DeFabbia-Kane
@Sam DeFabbia-Kane: True, but as the OP already is using :hover on div's I guess IE6 is not a requirement.
jeroen
+1  A: 
.tabOff:hover div.lightCorner {
  background:url(../Images/LightCorner.gif) no-repeat;
}
.tabOff:hover div.TL {
  top:0px;
  left:0px;
  background-position:0px 0px;
}
.tabOff:hover div.TR {
  top:0px;
  right:0px;
  background-position:-13px 0px;
}
David G