Effects on different objects from one mouseover

Elderly Newt

Senior member
May 23, 2005
430
0
0
I'm trying to get different effects to be applied to different objects when the user mouses over something. Just for example, lets say I want the box the user mouses over to turn blue and another box across the screen to turn red. I'm not quite sure how to implement this, I'm just learning CSS so it might be something relatively simple, but it's giving me a headache. Anyone have any ideas? Thanks.
 

AtlantaBob

Golden Member
Jun 16, 2004
1,034
0
0
I admit that I know virtually nothing about designing for the web (I just got dragged into a project here at work), but wouldn't that be implemented in javascript?

e.g. getElementById("otherbox");
setattribute(...
 

Elderly Newt

Senior member
May 23, 2005
430
0
0
I have no idea... i know virtually nothing about javascript :p

I'm trying to figure out a way to tag the objects so that it'll work out... but there's always some conflict that will undo something else I want. doh.
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
div#box:hover {
background-color: blue;
}

div#box:hover div#anotherbox {
background-color: red;
}

Try the above in your CSS.. I suspect it might not work if div#anotherbox is not a descendant of div#box.. but try it nonetheless :)

and oh.. IE6 doesn't support :hover for any element other than <a>.

edit: nope.. the above example doesn't work. look at the attached code.. that's the best I could come up with without using JavaScript. The only limitation is that "anotherbox" needs to be the next sibling element.. and no, the '+' CSS selector doesn't work in IE either :p

Take a look at this.. you can include it using conditional comments
 

Elderly Newt

Senior member
May 23, 2005
430
0
0
Thanks... I'll have to try those.

I'm becoming less and less of a fan of IE the more I do with HTML, CSS, etc... I keep on reading "so and so doesn't work with IE... this and that are ignored by IE..." Maybe because it's (IE6 at least) older than FireFox, but IE seems to have relatively poor support for some commands.
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
Originally posted by: Elderly Newt
Thanks... I'll have to try those.

I'm becoming less and less of a fan of IE the more I do with HTML, CSS, etc... I keep on reading "so and so doesn't work with IE... this and that are ignored by IE..." Maybe because it's (IE6 at least) older than FireFox, but IE seems to have relatively poor support for some commands.

Welcome to the world of client-side web development. You are right that IE doesn't support a lot things that they are suppose to :)