CSS Hover Image - Post ID 204320

User 2924428 Photo


Registered User
1,718 posts

Hey guy's, it's me once again :) . I need to know what the CSS code would be to create a hover image, like I have 3 buttons created, I want one for regular, one for hover, one for selecting the button. If you visit my site at www.kingfizz.com you can see the project i'm working on. The images are off to the right hand side of the page. Please help me with the coding, I think I did the menu right this time..
User 187934 Photo


Senior Advisor
20,267 posts
Online Now

What kind of effect do you want?;)
http://kyleschaeffer.com/user-experienc … age-hover/

http://www.w3schools.com/css/tryit.asp? … ansparency
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2924428 Photo


Registered User
1,718 posts

Hey Eric, it seems as if one site won't work, I have my menu directed to an <a> class already.. heres the code i'm using within the CSS..
/*Button Hover Code*/
.myButtonLink {
display: block;
width: 150px;
height: 40px;
background: url('button_hov_home.png') bottom;
text-indent: -99999px;
}
.myButtonLink:hover {
background-position: 0 0;
}
/*End Button Hover Code*/


Then within the body code.. it's ..
<a class="myButtonLink" href="http://www.kingfizz.com"><img src="buttons/button_reg_home.png" width="150" height="40" alt="" border="0"></a>


For some odd reason, the code isn't working for my CSS menu, I hover over my "Home" button and it stays the same, I have two images picked out for this particular project for each button. And I have like 5 different buttons to code with the hover link image.. I don't know what i'm doing wrong?
User 2073552 Photo


Registered User
1,625 posts

Is this for the http://kingfizz.com/ because I do not show that code linked to your menu button. There is no class on your home button for that matter. It is just an image. Did you take it down?

.myButtonLink:hover {
background-position: 0 0;
background: url('button_hov_home.png') bottom;
}

That is what your hover css should look like. You have the hov image in the regular style of the button. :) You need to place it in the hover element. :P
"An Apple doth not fall far from its tree, yet an orange does."

https://lbwebsitedesign.com - Responsive Web Design & Web Hosting Services.
http://helpsite.sirage.com - HTML5, CSS3 and CC Help Video Blog.
User 2924428 Photo


Registered User
1,718 posts

Got it to work with the second code Eric gave me, I just wont use images to do what CSS can do for me :) Thanks for the help guys, you can close this thread..

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.