Follow a model made in flex. Here is a complete guide that can help you. link
View full-screen code to see responsiveness and how they behave. On screens smaller than 768px they have the bigger box on top and smaller ones on the bottom. Large screens are side by side.
Thevalueshereareallin%soitgetsprettyresponsive,andtheheightofcontainer
Ileftwith50vh
,50%heightofbody
.Butyoucanputafixedvaluehereinpxifyouwanttoalwaysleavetheheightwiththedefinedsize.container{height:50vh;}
Hereisthecodefortheimageabove:
OBS:IcouldhaveoptimizedCSSmorebecausesomepropertiesrepeatalot,butIpreferredtoleaveittofacilitateunderstanding.
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
border: 1px solid #000;
}
.container {
width: 100%;
height: 50vh;
display: flex;
justify-content: center;
align-items: center;
}
.left {
width: 50%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.right {
width: 50%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.box {
width: 50%;
height: 50%;
display: flex;
justify-content: center;
align-items: center;
}
@media screen and (max-width:768px) {
.container {
flex-direction: column;
}
}
.left, .right {
width: 100%;
}
}
<div class="container">
<div class="left">esquerda</div>
<div class="right">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
</div>
</div>