If I have an image – say 20*20 pixels
I can use this line to resize the image – it will make the entire image smaller:
<img src="images/online-dating-main/blinking smile14x14.gif" width="14" height="14"/>
How can I do this resizing with CSS?
I have tried this but it just crops the image:
<div id="smile"></div>
div#smile {
background: url(../images/online-dating-main/smile.gif) no-repeat 0 0;
width: 14px;
height: 14px;
}
How can I do resizing with CSS?
thx
Add
background-size: contain;to thediv#smileselector.jsFiddle.
Note that browser support may be an issue. IE < 9 does not support this property.