I'm struggling to achieve the desired effect where the boxes labeled "HALF" only take up 50% of the width, evenly sharing the first row.
The main requirement is that these boxes remain within a single container. Is it possible to accomplish this using flexbox?
I've experimented with properties like flex-grow
, flex-shrink
, and flex-basis
, but I'm having trouble figuring out how to make it work while adhering to the single container restriction.
Take a look at this fiddle for reference: http://jsfiddle.net/GyXxT/270/
div {
border: 1px solid;
}
.container {
width: 400px;
display: flex;
flex-direction: column;
}
.child {
height: 200px;
}
.child.half {
flex: 1 1 10em;
color: green;
}
.child:not(.half) {
flex-shrink: 2;
flex-basis: 50%;
color: purple;
}
<div class="container">
<div class="child half">
HALF
</div>
<div class="child half">
HALF
</div>
<div class="child">
FULL
</div>
<div class="child">
FULL
</div>
<div class="child">
FULL
</div>
<div class="child">
FULL
</div>
</div>