A
A
Alexander Lashchevsky2014-02-17 20:35:54
css
Alexander Lashchevsky, 2014-02-17 20:35:54

How to implement img smaller side resizing?

Good evening!
Given:
1. DIV with dimensions 100x100px and overflow: hidden;
2. img inserted into a DIV of indefinite size (clearly larger than 100x100px).
What you need: It is
necessary that the image completely fills the entire existing div while maintaining its proportions.
If img has a width > height, then the height becomes 100px, while the width adapts proportionally and some part of it that crawls out of the div area is not visible.
If img has width < height, then the width becomes 100px, the height adapts... and so on.
What exactly is needed:
So that the size of 100px is assigned to the smaller side of the img.
Thanks in advance for any help.
Sincerely,
Alexander.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Lobanov, 2014-02-17
@Alexanevsky

jsfiddle.net/iiil/6uTMX/1

I
itspers, 2014-02-17
@itspers

What if it's simple
?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question