Can anyone assist me with the background-size: cover;
issue?
I'm facing a problem where the background image I set in the CSS
is covering the padding of my image box instead of staying inside the padding. Is there a way to use background: url()
and background-size
to keep the image inside the padding?
Here's what I have so far:
.image-container {
background: #eee;
width: 100%;
height: 120px;
}
.image-container div.image {
background: #ee1;
height: 100%;
width: 50%;
display: inline-block;
float: left;
padding: 4px 0px;
background: url("https://static.pexels.com/photos/14621/Warsaw-at-night-free-license-CC0.jpg");
background-size: cover;
}
<div class="image-container">
<div class="image"></div>
<div class="image"></div>
</div>