I am facing a challenge in getting the items within a container to occupy the space in the desired way. The main issue lies in the fact that flexbox and CSS grid are designed to adjust to changes in width rather than height, whereas I require the opposite behavior. Here is what I envision for my elements:
To see the desired effect, click here.
I have experimented with both flexbox and CSS grid layouts. Below is my current code, which still carries some remnants of my earlier attempts. Currently, it simply displays the images in their actual size. The height of the media container is altered using JavaScript.
.display-img {
padding:0px;
margin-top:-4px;
margin-bottom:-4px;
flex:0 1 auto;
height:auto;
}
.media-container{
width: auto;
height:800px;
display:flex;
//grid-template-rows: repeat(auto-fit,auto);
//grid-template-columns: repeat(auto-fit,minmax(200px,0.5fr));
flex-direction: row;
align-items: flex-start;
flex-wrap: wrap;
visibility: hidden;
}
<div class="media-container">
<img class="display-img" src="assets/projects/feierlichkeiten/23.png"></img>
<img class="display-img" src="assets/projects/feierlichkeiten/22.png"></img>
<img class="display-img" src="assets/projects/feierlichkeiten/21.png"></img>
<img class="display-img" src="assets/projects/feierlichkeiten/20.png"></img>
<img class="display-img" src="assets/projects/feierlichkeiten/19.png"></img>
</div>
Appreciate any ideas or suggestions from those who can help. Thank you!