How to style a link with CSS to change border color of image, but not add border around text?

I have CSS like this:

.videothumb{border:2px solid #2e2e2d;padding:4px;}
a.videolink,a.videolink:visited{color:#7d7c7b;text-decoration:none;}
a.videolink:hover{color:#7d7c7b;text-decoration:underline;border:2px solid #676765;}

Open in new window


My HTML link looks like this:

<a href="#"><img class="videothumb" src="img/img.jpg"><br />
Some text here</a>

Open in new window


So, I want a hover event to change the color of the border around the image but not add a border around the text part of the link, which is what it is doing currently.

I had also tried this:

.videothumb:hover{border:2px solid #676765}

Open in new window


That worked nicely for the image, but if you took the mouse off the image and just on the text part of the link, the border highlight would go away.

There must be some compromise between these two methods that will do what I want? Thank you!
Brad BansnerWeb DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle HamiltonData ScientistCommented:
give the link a class:
<a href="#" class="thumblink"><img class="videothumb" src="img/img.jpg"><br />
Some text here</a>

Open in new window


then in css:
.thumblink:hover .videothumb{border:2px solid #676765}

Open in new window




is this what you're looking for?
0
Brad BansnerWeb DeveloperAuthor Commented:
That didn't quite do it. Lets make this easier, here is my test page:
http://www.partnersdesign.net/lieverhymanpotter/videos.php

Here is the HTML and CSS I tried adding, based on your suggestion:

.videolink:hover{
		.videothumb{border:2px solid #676765;}
	}

<a class="videolink" href="videos.php?v=1"><img class="videothumb videospaceright" src="img/gr_video-1.jpg" width="149" height="84" border="0" /><br />
				John Badal speaks...</a>

Open in new window

0
Kyle HamiltonData ScientistCommented:
your style rule revised. it was incorrect.

.videolink:hover .videothumb{
   border:2px solid #676765;
      }

<a class="videolink" href="videos.php?v=1"><img class="videothumb videospaceright" src="img/gr_video-1.jpg" width="149" height="84" border="0" /><br />
                        John Badal speaks...</a>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brad BansnerWeb DeveloperAuthor Commented:
Perfect, thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.