I'm trying to align elements using flexbox
jsFiddle: https://jsfiddle.net/x6m7qnyp/
.container {
display: flex;
flex-wrap: wrap;
}
.left {
flex: 15%;
background-color: rgb(255, 0, 0);
height: 150px;
}
.rightTop {
flex: 85%;
background-color: rgb(0, 255, 0);
align-self: flex-start;
}
.rightBottom {
flex: 85%;
background-color: rgb(0, 0, 255);
}
<div class="container">
<div class="left">
LEFT
</div>
<div class="rightTop">RIGHT TOP</div>
<div class="rightBottom">RIGHT BOTTOM</div>
</div>
As you you can see, the last element goes down under the .left div even though I set flex to 85%.
What I want is to make the right bottom element fill the remaining space under the right top element. It should look like this:
I know that I can achieve this by wrapping right top and right bottom elements with a container, but I want to know if there is a way to do this with the current markup. And also, can you please explain why the right bottom element goes down instead of filling the remaining space?