By utilizing CSS Flexbox, you have the ability to split your layout into two parts (.left
& .right
) with widths of 20%
and 80%
respectively. Here's how:
.child.left {
flex: 20;
background: green;
}
.child.right {
flex: 80;
display: flex;
flex-direction: column;
}
Within the .right
child element, you can further divide the layout into two sections using flex-direction: column
to create a top-bottom arrangement, each occupying 20%
and 80%
of the parent width, like this:
.child.right .top {
flex: 20;
background: red;
}
.child.right .bottom {
flex: 80;
background: blue;
}
Take a look at the live example snippet below:
body {
margin: 0;
}
.parent {
display: flex;
width: 100vw;
height: 100vh;
}
.child.left {
flex: 20;
background: green;
}
.child.right {
flex: 80;
display: flex;
flex-direction: column;
}
.child.right .top {
flex: 20;
background: red;
}
.child.right .bottom {
flex: 80;
background: blue;
}
<div class="parent">
<div class="child left"></div>
<div class="child right">
<div class="top"></div>
<div class="bottom"></div>
</div>
</div>
I hope this explanation proves helpful!