Я рекомендую использовать CSS -Flexbox для решения вашей проблемы. следующий пример дает вам обзор, чтобы получить результат, аналогичный тому, который вы указали в своем вопросе:
body{
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
}
/*for smartphone / mobile*/
@media only screen and (max-width: 600px) {
.wrapper{
width: 100%;
height: 20%;
/*the following 3 lines make your Element behave as a flexbox element, the way it should behave and how it positions the elements inside of it*/
display: flex;
flex-direction: row;
justify-content: space-between;
}
.div1{
display: none;
}
.container-subdivs{
width: 80%;
height: 100%;
/*the following 3 lines make your Element behave as a flexbox element, the way it should behave and how it positions the elements inside of it*/
display:flex;
/*flex-flow is a combination of flex-direction and flex-wrap*/
flex-flow: row nowrap;
justify-content: space-between;
}
.subdiv1{
width: 10%;
height: 100%;
background-color: orange;
}
.subdiv2{
width: 15%;
height: 100%;
background-color: red;
}
.subdiv3{
width: 15%;
height: 100%;
background-color: yellow;
}
.div3{
height: 100%;
width: 15%;
background-color: pink;
}
}
/* for normal desktop, tablet etc.*/
@media only screen and (min-width: 601px) {
.wrapper{
width: 100%;
height: 100%;
}
.div1{
width: 100%;
height: 2%;
background-color: purple;
}
.container-subdivs{
width: 100%;
height: 20%;
/*See above comments*/
display:flex;
flex-flow: row wrap;
}
.subdiv1{
width: 80%;
height: 60%;
background-color: orange;
}
.subdiv2{
width: 20%;
height: 60%;
background-color: red;
}
.subdiv3{
width: 100%;
height: 40%;
background-color: yellow;
}
.div3{
margin-top: 4vh;
height: 20%;
width: 100%;
background-color: pink;
}
}
<div class="wrapper">
<div class="div1">
div1
</div>
<div class="container-subdivs">
<div class="subdiv1">
subdiv1
</div>
<div class="subdiv2">
subdiv2
</div>
<div class="subdiv3">
subdiv3
</div>
</div>
<div class="div3">
div3
</div>
</div>
Ключевым моментом здесь является то, как установить поведение flex-direction и flex-wrap, также вам нужно достаточно элементов, чтобы обернуть несколько других элементов, чтобы они вели себя в так же. Чтобы найти окончательное решение, вам нужно добавить несколько элементов и css для вашего гамбургер-меню, вы сами сможете это выяснить.
проверьте ЭТО , чтобы понять, что здесь происходит и как доработать подход. Удачи и не бойтесь задавать дополнительные вопросы в комментариях.