# Add padding around an image using CSS



## Talismanic (May 25, 2000)

I am trying to come up with a way in CSS to always add 2px of padding around an image. This is for a blog template and right now the text butts right about against the picture.

Here is an example of that I am talking about Liberty 1st Blog


----------



## namenotfound (Apr 30, 2005)

img {
padding: 2px;
}

That will put a padding of 2px around all 4 sides of all images.

If you only want padding around a select few images then add a class name

img.pad {
padding: 2px;
}


----------



## Talismanic (May 25, 2000)

Thank you. That did the trick.


----------

