I am trying to create a unique row-column-row layout using CSS flexbox. Below is the code snippet I have:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.container {
display: flex;
flex-wrap: wrap;
gap: 0.2%;
}
.box {
color: white;
background: royalblue;
min-height: 100px;
min-width: 100px;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid;
}
.b1 {
flex: 1 0 80%;
}
.b2 {
flex: 1 1 auto;
}
.b3 {
flex: 1 0 100%;
}
<div class="container">
<div class="box b1">1</div>
<div class="box b2">2</div>
<div class="box b3">3</div>
</div>
This design concept depicts what I am aiming for:
https://i.sstatic.net/cpFu2.png
For mobile devices, I prefer a layout similar to this:
https://i.sstatic.net/gLnKi.png
The issue lies in the fact that the column is not expanding vertically and I'm unable to utilize margins or gaps between the div elements as per the current code.
Kindly provide any suggestions. Alternatively, if you have CSS-Grid solutions, they are also welcomed.