User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 391,616 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,638 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 1542 | Replies: 8
Reply
Join Date: Jun 2006
Posts: 29
Reputation: Woobag is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Woobag Woobag is offline Offline
Light Poster

Image links and CSS

  #1  
Sep 9th, 2006
Hey, Im trying to do a CSS rollover border color change for my images (which are links). Problem is, the border only partly covers the image, going about half way up the image on the sides, and not covering the top at all.

Id post some code, but considering the easy nature of what im trying to do i didnt think it would be necessary.

Thanks for your help,
-ryan
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2004
Location: Hemet, CA
Posts: 427
Reputation: FC Jamison is on a distinguished road 
Rep Power: 5
Solved Threads: 17
Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Image links and CSS

  #2  
Sep 9th, 2006
...and

a:link img, a:visited img { border: 1px solid #000000 }
a:hover img { border: 1px solid #FF0000 }

didn't work?
Reply With Quote  
Join Date: Jun 2006
Posts: 29
Reputation: Woobag is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Woobag Woobag is offline Offline
Light Poster

Re: Image links and CSS

  #3  
Sep 11th, 2006
Yes, this works. Thanks for the help.

I saw something reference the "img" part in CSS, but i couldnt apply it to work correctly in my situation.

Sweet, and since i wanted to name it, i came up with this.

#car:link img, #car:visited img { border: 1px solid #000000 }
#car:hover img { border: 1px solid #FF0000 }
Reply With Quote  
Join Date: Jun 2004
Location: Hemet, CA
Posts: 427
Reputation: FC Jamison is on a distinguished road 
Rep Power: 5
Solved Threads: 17
Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Image links and CSS

  #4  
Sep 11th, 2006
You might have some cross-browser compatibility issues with that solution.
Reply With Quote  
Join Date: Jun 2006
Posts: 29
Reputation: Woobag is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Woobag Woobag is offline Offline
Light Poster

Re: Image links and CSS

  #5  
Sep 12th, 2006
You guessed it. In I.E. the image links are the lighter gray, and do not change colors. The image links at the top of my page (this page is included by a index.php - for example) are showing in the purple "visited" color as the would do so normally. I think i can solve the latter of those two problems, but what do you think about correcting the first?
Reply With Quote  
Join Date: Jun 2004
Location: Hemet, CA
Posts: 427
Reputation: FC Jamison is on a distinguished road 
Rep Power: 5
Solved Threads: 17
Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Image links and CSS

  #6  
Sep 13th, 2006
If you've named the image, try

a:link img#car, a:visited img#car { border: 1px solid #000000 }
a:hover img#car { border: 1px solid #FF0000 }
Reply With Quote  
Join Date: Jul 2006
Posts: 2
Reputation: Spector is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Spector Spector is offline Offline
Newbie Poster

Re: Image links and CSS

  #7  
Sep 13th, 2006
why dont you just make diffrent images for rollover?
Reply With Quote  
Join Date: Jun 2006
Posts: 29
Reputation: Woobag is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Woobag Woobag is offline Offline
Light Poster

Re: Image links and CSS

  #8  
Sep 14th, 2006
Rollovers are more complicated, and customizing them on the fly is a bit of a pain. I am going for a style and it can be acheived both ways, and this way is the easiest.

Edit- I still get no "hover" functionality in IE6.
Last edited by Woobag : Sep 14th, 2006 at 6:36 pm.
Reply With Quote  
Join Date: Jun 2004
Location: Hemet, CA
Posts: 427
Reputation: FC Jamison is on a distinguished road 
Rep Power: 5
Solved Threads: 17
Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Image links and CSS

  #9  
Sep 14th, 2006
ok...on my photo gallery page (http://www.frankjamison.com/gallery/), I use a combination of css and javascript to achieve this effect.

[html]
<img src="image.jpg'" class="rolloverOff" onMouseOver="this.className='rolloverOn'" onmouseout="this.className='rolloverOff'" /></a>
[/html]

.rolloverOff {
  border: 1px solid #999999;
}

.rolloverOn {
  border: 1px solid #FFFFFF;
}
Last edited by FC Jamison : Sep 14th, 2006 at 8:58 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb HTML and CSS Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 12:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC