<div class="container">
<div class="grid">
<div class="cell">
<div class="inside big"></div>
</div>
<div class="cell">
<div class="inside big"></div>
</div>
<div class="cell">
<div class="inside medium"></div>
</div>
<div class="cell">
<div class="inside big"></div>
</div>
<div class="cell">
<div class="inside small"></div>
</div>
<div class="cell">
<div class="inside medium"></div>
</div>
<div class="cell">
<div class="inside small"></div>
</div>
<div class="cell">
<div class="inside big"></div>
</div>
<div class="cell">
<div class="inside medium"></div>
</div>
<div class="cell">
<div class="inside small"></div>
</div>
<div class="cell">
<div class="inside big"></div>
</div>
</div>
</div>
@gutter-size: 20px;
.container {
border: 1px solid red;
overflow: hidden;
}
.grid {
display: flex;
flex-wrap: wrap;
margin: -(@gutter-size / 2);
}
.cell {
padding: (@gutter-size / 2);
box-sizing: border-box;
width: 25%;
background: lightgray;
z-index: -1;
}
.inside {
background: blue;
}
.big {
height: 200px;
}
.medium {
height: 100px;
}
.small {
height: 50px;
}
img {
display: block;
}
@media (max-width: 1000px) {
.grid {
flex-direction: column;
}
.cell {
width: 100%;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.