FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

css hover

 


yo.hassan
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!
Fuzzy-Duck
Hi hassan,

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
PseudoKnight
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:

Code:
<div onmouseover="this.style.bgcolor='#CCCCCC'" onmouseout="this.style.bgcolor='#FFFFFF'">
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.