How to make this flex item layout in html/css?
.container
{
display: flex;
flex-flow: wrap;
justify-content: flex-start;
flex-wrap: wrap-reverse;
gap: 3%;
}
<div class="container">
<div class="item">
<img src="img/1.png"></img>
</div>
<div class="item">
<img src="img/2.png"></img>
</div>
<div class="item">
<img src="img/3.png"></img>
</div>
</div>
I used the following code to create this tile layout, but I get this similar output:
sample
2
Answers
In this layout, we have the first item which is taken at the full height of the container on the left side, and we need the other two elements to occupy the space on the right side between them.
One approach that we can take is to give a fixed height to the container and the first item’s height will be the full height of the container. The other two elements (item2, item3) will go to the right side if we set flex-wrap:Wrap and flex-direction: column. and here is a Codepen for what I am saying Link
This is what you want.