JSFiddle - React, Tailwind, and code Playground
by Per Andersson
HTML
<div class="wrapper">
<div class="flex-container">
<div class="flex-col-1">
<div class="flex-row-1">
</div>
<div class="flex-row-2">
</div>
</div>
<div class="flex-col-2">
<div class="flex-row-1">
</div>
<div class="flex-row-2">
</div>
</div>
<div class="flex-col-3">
<div class="flex-row-1">
</div>
<div class="flex-row-2">
<div class="flex-col-3-inner">
<div class="flex-col-1-inner">
</div>
<div class="flex-col-2-inner">
</div>
</div>
</div>
</div>
</div>
</div>
CSS
html, body {
margin: 0;
}
.wrapper {
position: relative;
}
.wrapper:after {
padding-top: 56.25%; /* 16:9 ratio */
display: block;
content: ' ';
}
.flex-container {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
padding: 5px;
display: flex;
}
.flex-container > div { /* .flex-col-1, .flex-col-2, .flex-col-3 */
height: 100%;
display: flex;
flex-direction: column;
}
.flex-container > div > div { /* .flex-row-1, .flex-row-2 */
margin: 5px;
display: flex;
}
.flex-col-1 {
width: 25%;
}
.flex-col-1 .flex-row-1 {
height: 70%;
background: #ddd url(https://placeimg.com/400/600/arch) no-repeat center;
background-size: contain;
}
.flex-col-1 .flex-row-2 {
height: 30%;
background: #ddd url(https://placeimg.com/400/600/arch) no-repeat center;
background-size: contain;
}
.flex-col-2 {
width: 32.5%;
}
.flex-col-2 .flex-row-1 {
height: 80%;
background: #ddd url(https://placeimg.com/400/600/arch) no-repeat center;
background-size: contain;
}
.flex-col-2 .flex-row-2 {
height: 20%;
background: #ddd url(https://placeimg.com/400/600/arch) no-repeat center;
background-size: contain;
}
.flex-col-3 {
width: 42.5%;
}
.flex-col-3 .flex-row-1 {
height: 44%;
background: #ddd url(https://placeimg.com/400/600/arch) no-repeat center;
background-size: contain;
}
.flex-col-3 .flex-row-2 {
height: 56%;
}
.flex-col-3-inner {
flex: 1;
display: flex;
}
.flex-col-3-inner .flex-col-1-inner {
width: 40%;
margin-right: 5px;
background: #ddd url(https://placeimg.com/400/600/arch) no-repeat center;
background-size: contain;
}
.flex-col-3-inner .flex-col-2-inner {
width: 60%;
margin-left: 5px;
background: #ddd url(https://placeimg.com/400/600/arch) no-repeat center;
background-size: contain;
}