i have a 200x200 pixel grey color div with some text in it. now i want to change the whole div color to something else. i tried with css .a anchor class but its not working the way i want. so i need to use a hover class. please share if you know. thank you!
css hover
Hi hassan,
I'm not sure exactly what you require, perhaps you could post your source code?
However, if all you want is to change the colour of the background when the user hovers over the div then:
...would be the simplest solution.
Just put the code in your *.css file and change mydiv and #newcolour to what you want of course! This will only work in Mozilla/Firefox though, for IE you would need to use anchors, but as I said above I'd have to see your code to help you out with that bit!
Hope this helps,
fuzzy
I'm not sure exactly what you require, perhaps you could post your source code?
| yo.hassan wrote: |
| i have a 200x200 pixel grey color div with some text in it. now i want to change the whole div color to something else. i tried with css .a anchor class but its not working the way i want. so i need to use a hover class. please share if you know. thank you! |
However, if all you want is to change the colour of the background when the user hovers over the div then:
| Code: |
| div.mydiv:hover { background-color: #newcolour } |
...would be the simplest solution.
Just put the code in your *.css file and change mydiv and #newcolour to what you want of course! This will only work in Mozilla/Firefox though, for IE you would need to use anchors, but as I said above I'd have to see your code to help you out with that bit!
Hope this helps,
fuzzy
It's probably also possible with some basic javascript, if that's an option you want to consider.
Something like this, if I'm not mistaken:
Something like this, if I'm not mistaken:
| Code: |
| <div onmouseover="this.style.bgcolor='#CCCCCC'" onmouseout="this.style.bgcolor='#FFFFFF'"> |
