[thelist] CSS, image border color and IE

Aylard JA (James) jaylard at equilon.com
Mon Nov 6 10:27:06 CST 2000


Niklaus,

> I'm trying to add borders to images using CSS.

	For IE, the easiest way to do this:

img { border: 1px solid #000000 ; }

	This will assign a 1 pixel black border to *all* images, however, so
you might want to be a bit more specific (using your html snippet as an
example):

<a href="#"><img class="pic" src="pic.jpg" border="0"></a>

	and in your style sheet:

img.pic { border: 1px solid #000000 ; }

	The inclusion of the border attribute in the img element itself
isn't necessary. Also, Netscape 4 handles this all very poorly, creating a
little floating box outside of the image, so you might want to use browser
detection before applying the style in this way (which is
standards-compliant, btw).

hth,
James Aylard




More information about the thelist mailing list