h-gqfg
Last Updated: February 25, 2016
·
2.752K
· themusyo
10684317 693196797432883 114022871 n

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;
}

Say Thanks
Respond

4 Responses
Add your response

2818
Livi

I don't see how you code is resizing image? It's just cropping an image.

over 1 year ago ·
3373
D42a7264714dee5006b9c99d2567a320

agreed, that's not resizing

over 1 year ago ·
3375
10684317 693196797432883 114022871 n

@dpashkevich I changed the title.

over 1 year ago ·
3376
D42a7264714dee5006b9c99d2567a320

@musyo people just call it crop :)

over 1 year ago ·