thundercade64 Posted March 20, 2006 Share Posted March 20, 2006 I have the following code in a style sheet:div.sidelink:hover, div.sidelinksmall:hover { background-color:#CC66CC; }which, when I hover over any <div class="sidelink"> or <div class="sidelinksmall"> changes the background color to that above. This works perfectly in Firefox, but it doesn't work at all in IE. What am I doing wrong, or what should I do so I can have the background of a div element change color upon hover in IE.Thanks. Link to comment Share on other sites More sharing options...
raimo Posted March 20, 2006 Share Posted March 20, 2006 What am I doing wrong, or what should I do so I can have the background of a div element change color upon hover in IE.You are doing nothing wrong, IE is doing everything wrong (allmost). :)IE only supports hover with a-element. I think with IE there is no other way toget hover work with other elements than javascript.<script type="text/javascript"><!--function hover(id, color){document.getElementById(id).style.backgroundColor = color;}//--></script><div id="d1" onmouseover="hover(this.id, '#CCFFCC')" onmouseout="hover(this.id, '')">Div1</div><div id="d2" onmouseover="hover(this.id, '#CCFFCC')" onmouseout="hover(this.id, '')">Div2</div> there is many other ways to do this with JS/DOM, but this one is easy :)Not working good if You have huge array of divs, but in "normal" doc there should be no problems.edit:do it without function and id: <div onmouseover="this.style.background='#CCFFCC'" onmouseout="this.style.background=''">Div1</div> Link to comment Share on other sites More sharing options...
snowboard01 Posted March 20, 2006 Share Posted March 20, 2006 I love making text change color i sure hope that ie7 will have the hover element for all Link to comment Share on other sites More sharing options...
thundercade64 Posted March 20, 2006 Author Share Posted March 20, 2006 Thanks for the verification on IE, and that JS code. I'm still in the thick of learning HTML/CSS and the differences bewteen IE and Firefox (mostly bad things about IE) are driving me nuts!!Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now