You can do this with a second layer of flexboxes in a relatively straight forward fashion. Note, I created a wrapper around the second group of non-navbar cells
HTML:
<div class="no-sidebar">
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
</div>
<hr/>
<div class="grid has-sidebar">
<div class="cell sidebar"><div>Sidebar (Full height?)</div></div>
<div class="main-contents">
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
<div class="cell product"><div>Cell</div></div>
</div>
</div>
CSS:
HTML, BODY { box-sizing: border-box; }
*, *:before, *:after { box-sizing: inherit; }
BODY {
padding: 30px;
}
.no-sidebar {
display: flex;
flex-wrap: wrap;
flex-direction: row;
.cell {
width: 25%;
> DIV {
padding: 10px;
border: 1px solid red;
}
}
}
.has-sidebar {
.cell {
> DIV {
padding: 10px;
border: 1px solid red;
}
}
display: flex;
.sidebar {
display: flex;
flex: 0 0 25%;
align-items: stretch;
> DIV {
width: 100%;
background-color: blue;
}
}
.main-contents {
display: flex;
flex-wrap: wrap;
flex-direction: row;
flex: 1 0;
.cell {
flex: 1 0 33%;
}
}
}
.product {
> DIV {
background-color: pink;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…