fit image in a smaller div without stretching it
html:
make a div with class="imageholder" and inside it put an img control.
css:
.imageholder {
width: 512px;
height: 512px;
overflow: hidden;
}
Written by ali mousavi
Related protips
4 Responses
I don't see how you code is resizing image? It's just cropping an image.
over 1 year ago
·
agreed, that's not resizing
over 1 year ago
·
@dpashkevich I changed the title.
over 1 year ago
·
@musyo people just call it crop :)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#