hover background image

Thread Solved

Join Date: Mar 2007
Posts: 1,429
Reputation: Nichito is an unknown quantity at this point 
Solved Threads: 30
Featured Poster
Nichito's Avatar
Nichito Nichito is offline Offline
Nearly a Posting Virtuoso

hover background image

 
0
  #1
Feb 19th, 2008
i designed some images to put in the navbar... the idea was putting them so that when they're hovered, there is an image change to another image with bthe same design but different colors...

when i pretended to do this i found a serious problem... if i insert the image in the html, there's no way i can change it unless i use javascript (and i'm trying to avoid the excess of javascript)... if i put it as a table background, specifying the cell's width and height, nothing happens, it doesn't even place the image... if i use it as a hyperlink background, the image will be resized to the space needed by the text in the hyperlink...

so, as you can see, i'm in a bit of a problem... i hope you get the idea of what i want to do...

anyone knows how to solve it?
-->sometimes i wanna take my toaster in a bath<--
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 154
Reputation: katarey is an unknown quantity at this point 
Solved Threads: 20
katarey's Avatar
katarey katarey is offline Offline
Junior Poster

Re: hover background image

 
0
  #2
Feb 20th, 2008
Hi there,

Try This Code this May Help you
CSS:
HTML and CSS Syntax (Toggle Plain Text)
  1. <style type="text/css">
  2. .links {
  3. font-family:Verdana, Arial, Helvetica, sans-serif;
  4. display:block; /*This Cover Full TD */
  5. background:url(link.png) center top no-repeat; /*This Will Set the Link background */
  6. height:25px; /*This Will Make Fixes Size Link (Use Image height)*/
  7. width:100px; /*This Will Make Fixes Size Link (Use Image width)*/
  8. line-height:25px;
  9. text-align:center;
  10. font-size:10pt;
  11. text-decoration:none;
  12. }
  13. .links:hover {
  14. background:url(hover-link.png) center top no-repeat;
  15. }
  16. </style>
HMTL:
HTML and CSS Syntax (Toggle Plain Text)
  1. <table width="100" border="0" cellspacing="0" cellpadding="0">
  2. <tr>
  3. <td><a href="#" class="links">Link</a></td>
  4. </tr>
  5. </table>

Regards,
Rahul Dev Katarey
Freelance Web Designer & Developer
Http//www.Katarey.com
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 1
Reputation: Ira_Gaines is an unknown quantity at this point 
Solved Threads: 1
Ira_Gaines Ira_Gaines is offline Offline
Newbie Poster

Re: hover background image

 
0
  #3
Nov 23rd, 2008
Rahul, you sir are a CSS god amongst men.

Ive been looking around for this exact bit of code for so long, the ability to change my background image when i mouseover a menu bar, and this hits the spot nicely.

I felt compelled to join this site so I could thank you personally. Thanks!

Take care,
Lee
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 89
Reputation: wickedsunny is an unknown quantity at this point 
Solved Threads: 4
wickedsunny wickedsunny is offline Offline
Junior Poster in Training

Re: hover background image

 
0
  #4
Nov 29th, 2008
katarey have solved ur problem through css nicely!!! u can avoid to much javascript by using simple roll over option in the dreamweaver i guess. do give it a try to
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 1
Reputation: bpanks is an unknown quantity at this point 
Solved Threads: 0
bpanks bpanks is offline Offline
Newbie Poster

Re: hover background image

 
0
  #5
Mar 8th, 2009
Thanks a lot for such a wonderful and easy to use CSS trick.
keep it up!!!


-Pankaj
Mumbai
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC