Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1675

CSS flex-basis not working when flex-direction is 'column'

$
0
0

My goal is to create a two-column layout with flexbox wherein the first column has two rows and the second column has one, like this:

enter image description here

Setting flex-basis: 100% on the third item gives the desired effect, but only when the container's flex-direction is row:

enter image description here

Changing flex-direction to column results in the following, unless the height is set explicitly, which is infeasible in my project:

enter image description here

How can I get the first image without explicitly setting the height of the container?

Here's a Plunker illustrating the problem.

body {  display: flex;  height: 100px;  width: 100px;}.container {  display: flex;  flex-direction: column; /* Setting this to `row` gives the expected effect,but rotated */  flex-grow: 1;  flex-wrap: wrap;  /* height: 100%; */ /* Setting this fixes the problem, but is infeasible for my project*/}.item {  flex-grow: 1;}.one {  background-color: red;}.two {  background-color: blue;}.three {  background-color: green;  flex-basis: 100%;}
<div class="container"><div class="item one">&nbsp;</div><div class="item two">&nbsp;</div><div class="item three">&nbsp;</div></div>

Viewing all articles
Browse latest Browse all 1675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>