Implementing the flexbox
property is straightforward - all you need is a container for three div
elements.
First, create a div with a class of .box
and insert the respective div
elements. Assign classes for colors: .red
, .green
, and .blue
; and also classes to manage columns: left
and right
.
<div class="box">
<div class="left red"></div>
<div class="right green"></div>
<div class="right blue"></div>
</div>
Next, declare the box
class as a flexbox:
.box {
display: flex;
...
}
Specify the direction as column
(vertical) and if it should be allowed to wrap using wrap
:
.box {
...
flex-flow: column wrap;
...
}
You can also set the dimensions of the div
elements. The left
one will occupy 45%
of the parent's width
and 100%
of its height
.
.left {
width: 45%;
height: 100%;
}
Meanwhile, the right
element will take up 55%
of the parent's width
and half (50%
) of its height
.
.right {
width: 55%;
height: 50%;
}
Complete example shown below:
.box {
display: flex;
flex-flow: column wrap;
width: 400px;
height: 100px;
}
.red {
background: #cc092f;
}
.green {
background: #09cc69;
}
.blue {
background: #0980cc;
}
.left {
width: 45%;
height: 100%;
}
.right {
width: 55%;
height: 50%;
}
<div class="box">
<div class="left red"></div>
<div class="right green"></div>
<div class="right blue"></div>
</div>