Give Background Image Padding

Posted By Weston Ganger

If you want to have a background image with size of cover or contain then sometimes you dont want the image to go right to the edge of your div

What you can do is apply a transparent border to your div like so:


<div class="myDiv"></div>

The CSS:

  background:url('myBackgroundImage.png') center center no-repeat;
  border: 10px solid transparent;

Article Topic:Software Development - HTML / CSS

Date:July 08, 2014