I have been wrestling with flex and how to do a simple grid, with different widths, and then to make them stackable in mobile.
-------------------
menu | A1 | B1
| A2 | B2
--------------------
But then, when responsive, stacks to:
------------
A1
------------
B1
------------
A2
------------
B2
(the menu becomes a burger already)
So far I have:
.flex-row {
display: flex;
flex: 1;
flex-direction: row;
flex-wrap: wrap;
}
.flex-col {
margin: 6px;
padding: 0px;
background-color: black;
display: flex;
justify-content: center;
flex: 1;
flex-direction: column;
color: white;
}
<div class="container">
<div class="sidebar-menu-col">
menu here
</div>
<div class="flex-col">
<div class="flex-col">A1</div>
<div class="flex-col">B1</div>
<div class="flex-col">A2</div>
<div class="flex-col">B2</div>
</div>
</div>
For some reason, I cannot get the width to work even when using something like flex: 0 0 15em;. In desktop, then things don't look good, and all show up as cols. Wondering how to break it so it's 2x2 on desktop (aside from the menu) and stacked in mobile.