I'm trying to figure out how to get this in Flexbox, but the only thing I can get is in the code snippet:
Do you have an idea to manage this CSS only (I can't really touch the structure of the HTML as it is a PHP foreach
loop)?
Could using CSS grid
help here?
.grid {
display: flex;
justify-content: start;
flex-wrap: wrap;
}
.photo {
position: relative;
flex: 0 0 calc(25% - 20px);
margin: 10px;
align-self: flex-start;
overflow: hidden;
background: black;
}
.photo:after {
content: "";
display: block;
padding-top: 100%;
}
.large {
flex: 0 0 calc(50% - 20px);
}
<div class="grid">
<div class="photo large"></div>
<div class="photo"></div>
<div class="photo"></div>
<div class="photo"></div>
<div class="photo"></div>
</div>