css - how to fit image without stretching and maintain aspect ratio in div tag in html -
my image size 640*820.and want fit image screen of size 310*520. while doing maintain aspect ratio(without stretch).
<div class="abc" style=" background: url("images/phone.png"); position: absolute; max-width: 100%; width: auto; margin-left:10px; background-size: contain; top: 50px;">
you state width of image , have height auto
.div img { width: 310px; height: auto; } <div class="div"> <img src="#" title="#"> </div>
Comments
Post a Comment