I'm building a Lightbox gallery, based on following template: https://www.w3schools.com/howto/howto_js_lightbox.asp
I've got a problem with properly displaying pictures in Modal Gallery. I want to fit them to the screen.
I've got a following div construction: body > div#myModal2.modal > div.modal-content > div.mySlides2 > img
HTML:
<div id="myModal2" class="modal">
<span class="close cursor" onclick="closeModal2()">×</span>
<div class="modal-content">
<div class="mySlides2">
<div class="numbertext">1 / 6</div>
<img src="images/wzory/1.jpg" style="width:100%">
</div>
CSS:
.modal {
display: none;
position: fixed;
z-index: 999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: black;
}
.mySlides2 {
display: none;
}
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
max-width: 80%;
max-height: 100%;
}
Long story short when editing .modal-content "max-width: 80%" I can change the size of modal (and the picture in it) without any problem and fit it properly to the screen size. But editing "max-height" it's not working properly. The big pictures are "too long" and they do not fit the screen.
Why "max-width: 80%" works perfectly fine, but "max-height: 100%" does not?