Click to See Complete Forum and Search --> : Padding an Image


Nulrick
10-29-2003, 01:43 PM
Hi!


I'm trying to apply padding around some images, but it's only working on macs, not on PCs.


This is the code I'm using:


<STYLE TYPE="text/css">
body {background: #5CD6AD url(images/contentpagegreenbg.jpg) repeat-x;}

.pad {padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
padding-bottom: 10px; }

.pad2 {padding: 25px;}

</STYLE>



<a href="home.html"><img class="pad2" src="images/legal.gif"></A>

<br>

<a href="content.html"><img class="pad" src="images/core.jpg">

gil davis
10-29-2003, 01:56 PM
Padding is a block element property. Maybe that is why it doesn't work in some browsers. I know you can use the HTML border attribute on an image to do the same thing, but that isn't CSS. If you can't get it right, enclose the IMG in a SPAN and apply the padding to the SPAN. Or, since you already have the image inside an A tag, apply the class to the A tag.