Give Background Image Padding

Posted By Weston Ganger

<p>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</p>
<p>What you can do is apply a transparent border to your div like so:</p>
<p>The HTML:</p>

.myDiv{
  background:url('myBackgroundImage.png') center center no-repeat;
  background-size:cover;
  border: 10px solid transparent;
}

Article Topic:Software Development - HTML / CSS

Date:July 08, 2014