If you can fill in so images with css?

There is a fixed container in which you can get a picture with a width that is smaller than the container and Vice versa with a width which is greater than the container. To do so in the first case aligns the width to 100% and the second at a height of 100%.
The result of the link, but can it be done without naveshivanie additional class that is determined automatically and chose the right option.
https://jsfiddle.net/m8h9uepw/
March 19th 20 at 08:52
1 answer
March 19th 20 at 08:54
.container {
 width: 130px;
 height: 250px;
 border: 2px solid black;
}

img {
 width: 100%;
 height: 100%;
 object-fit: cover;
 object-position: center;
}
it gives different results, not like in my example - Stewart_Carroll commented on March 19th 20 at 08:57
I agree, then in your question the answer is no, without a separate class is not enough. - emmitt.Kemmer25 commented on March 19th 20 at 09:00

Find more questions by tags HTMLCSS