|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hovering over X but affecting Y
A thousand apologies -- this is a very poorly worded and general question, because I've learned through scavenging and don't know the jargon, and the answer might not even lie in CSS... but the problem is really driving me to distraction.
Is it possible in CSS to define a hover effect such that upon hovering over one element, a different element is affected? For example, I know you can add something like this: #example a:hover{ color: #000000; } in order to change the color of any links in the example div upon hovering. But can you change properties of links in any other divs? If so, then how? And if not, then is there a different language which can effect this change? Again, a thousand apologies for the amateurishness and outsider-wording of this question. I will be happy to clarify on request to the extent of my ability. |
|
#2
|
||||
|
||||
|
Sure, this code should do what you want. Hover over first link to change second link. There are other selectors for this sort of thing, but its just sort of a general idea.
Code:
<!DOCTYPE html>
<html>
<head>
<title>Something</title>
<style type="text/css">
#hover1:link,
#hover2:link{
color:black;
}
#hover1:hover+#hover2{
color: #0099cc;
}
</style>
</head>
<body>
<a id="hover1" href="#">Something</a> | <a id="hover2" href="#">Something</a>
</body>
</html>
__________________
"Quality of responses may vary. I reserve the right to change my mind for any reason what-so-ever without admitting I was wrong. I'd prefer to change your mind however, it's easier on my ego". - jwdonahue Last edited by Skipt : June 27th, 2009 at 10:26 AM. |
|
#3
|
|||
|
|||
|
Many thanks
![]() |
|
#4
|
||||
|
||||
|
Do note that IE6 doesn't recognize :hover on any element besides the <a> tag. You could need a behavior code for IE to recognize :hover for all elements.
|
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > Hovering over X but affecting Y |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|