With my code, I centered the image inside of the div. This solution works fine for images that are squarish or in landscape format, but not with the ones in portrait format.
The HTML looks like this:
<div class="gallery"><img class="gallery"></div>
This is my CSS:
div.gallery {
position: relative;
z-index: 2;
overflow: hidden;
}
img.gallery {
height:100%;
min-width: 100%;
position: absolute;
top: -9999px;
bottom: -9999px;
left: -9999px;
right: -9999px;
margin: auto;
box-sizing: border-box;
z-index: 1;
}
I tried to put img.gallery on
min-width: 100%;
max-width: 100%;
but that does not do the Job as the pictures then are far to big in the div. Does anyone have a clue for me?