PDA

View Full Version : CSS No border around 1 image only help



Markxxx
01-09-2007, 04:10 AM
OK this is what I need to do. I have small gifs on my page. I do not want a border around them. So in the style section I put

img{border:none;}

That works great.

However at the bottom is an image and this image is also a "back" button that returns the user to the main page. It is also in a seperate division called "ctr"

So basically the HTML looks like
<div class="ctr"
<a href="index.html">
<img src="back.gif" alt="back.gif">
</a>
</div>

What I want to do is but a border around that image (which is also a link) and NOT have a border around any other image. I tried a few things but I either wind up with borders around all my links or a border around the class called "ctr" instead of just the image INSIDE of that class.

If you got any answer I'd appreciate it.

BLiZZaRD
01-09-2007, 05:11 AM
Have you tried adding a border declaration to the img src tag?



<img src="back.gif" alt="back.gif" border="1">

jscheuer1
01-09-2007, 05:13 AM
.ctr img {
border: 1px solid blue;
}

BLiZZaRD
01-09-2007, 05:15 AM
Or that :D

Markxxx
01-09-2007, 05:26 AM
Thanks guys

Blizzard, of course your way is fine, but I try to keep my pages so they will validate with XHTML. I didn't mention it

jscheuer1

Thanks your way worked perfectly.

I appreciate both your help

mark