chodoy
asked on
CSS link hover
Hello,
I created a rule which is a colored div box with hot linked text within. I would like to make a hover action in which the surrounding div would change color. Is this possible with CSS?
Thank you.
I created a rule which is a colored div box with hot linked text within. I would like to make a hover action in which the surrounding div would change color. Is this possible with CSS?
Thank you.
.menubox {
background-color: #b5ede4;
height: 21px;
width: 156px;
padding-top: 10px;
padding-left: 12px;
font-weight: bold;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #FFF;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #91519c;
text-decoration: none;
}
You could do:
.menubox:hover {
background-color:red;
}
but it may not work in IE, only firefox
.menubox:hover {
background-color:red;
}
but it may not work in IE, only firefox
Sorry I'm wrong, never mind
ASKER
Hi Jason,
I'm still missing something. When I apply the link it does not take on the appropriate style for the "menubox"
If I add a class, It then duplicates too much of the box attributes I don't want:
<div class="menubox"><a href="index.html" class="menubox">home</a></ div>
I'm still missing something. When I apply the link it does not take on the appropriate style for the "menubox"
If I add a class, It then duplicates too much of the box attributes I don't want:
<div class="menubox"><a href="index.html" class="menubox">home</a></
The :hover attribute will change whatever element is being hovered. So if you want the div to change, you apply the class to the div only.
If you want the link to change, then you apply the class to the link only (and change it so it matches the link CSS).
If you want the link to change the div, you're now in Javascript territory.
If you want the link to change, then you apply the class to the link only (and change it so it matches the link CSS).
If you want the link to change the div, you're now in Javascript territory.
ASKER
Yes, I do want the link to change the div. Can you point me in the right direction for the javascript?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window