I have a div (suppose 30px width and 30px height) and i am using a sprite image for all the images ,now there is one image in the sprite at background-position : -12px -1467px
(just an example)
whose width and height is 70px and i want to apply this image as background to given div.
The problem is how to scale that image to fit in the div size.
This should not break if i increase or decrease the div size based on resolution.
My sprite's width and height can be changed (more images can be added later in the sprite).
This question may be duplicate as few people suggested but i am not able to understand those question properly. I have created a fiddle for this.
In the fiddle 2nd div
shows the original sprite,and in the first div
i want to show only first image but when i resize the div the first image should resize with div (like if i am using an individual image instead of a sprite).
One way to do this to have first div
equal to first image and then on resize use something like transform:scale(.5)
,but i don't want to use that.