Hello I want to change automatically container height to responsive image.
I set container's display on flex. The image is between 2 div with class = "text-block"
. Div's have width of width: 37%
and min-width: 37%
. Image width is set to max-width:100%
so it's responsive and change its width and height when I change screen width.
I want to shrink container's height with image height. The height of container has to be always equal to image height. Also I would like that container and image height does not exceeded 100vh
when they are getting bigger.
PHOTO:
containers height adjust to img height
height of container and img don't exceed height of 100vh
LINK to problem: Here is my code on codepen: https://codepen.io/milkiway420/pen/xxrVgMZ
body {
height:100%;
}
.container{
display: flex;
width: 100%;
}
.text-block {
width: 37.645448%;
min-width:37.645448%;
background: #e3e3e3;
}
img {
max-width:100%;
}