I'm trying to create a full-screen image view. In addition to the full screen image, they will be able to optionally show some info about that image (title, description, tags, etc.)
If I have something like this...
<html>
<div class="container">
<img src="https://i.insider.com/5c65a75d74c587423d6a711a?width=1100&format=jpeg"/>
</div>
</html>
.container {
display: flex;
flex-flow:column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
background-color: orange;
left: 0;
top: 0;
position: fixed;
}
img{
max-width: 90%;
max-height: 90%;
}
The image resizes cleanly no matter how much I mess with the height of the window.
But when I add another div to the markup after the img, and try resizing the height again... the image only starts to resize once it already runs partially off the page.
https://codepen.io/Nickprovs/pen/pojXzVw
How can I prevent that?
I basically want the bottom div (informational div) to have an automatic size based on its content and for the image to resize in the available space to fit.
Bad: Image not resizing in time when another element is in flexbox. Gets cut off.
Good: Picture resizes just fine when all by itself in the flexbox.