I have a unique situation where I am working with a large image sprite that is 1030px by 510px and contains two smaller images, each being 515px by 515px. My goal is to extract the two small images from the sprite and set them as backgrounds for two <img>
tags using the following code:
.img-1, .img-2 {
width: 515px;
height: 515px;
background: url(https://i.sstatic.net/aozNS.png) no-repeat;
}
.img-1 {
background-position: 0px 0px;
}
.img-2 {
background-position: -515px 0px;
}
<div class="col-sm-6">
<img class="img-1">
</div>
<div class="col-sm-6">
<img class="img-2">
</div>
However, I encountered an issue where the two images appear larger than my div containers with the class "col-sm-6". Is there any way to make the small images fit within the divs without changing their size to be larger (e.g., changing to "col-sm-7")?