Descriptive plunker: http://plnkr.co/edit/remH1RtkY1qBk0A7J4Tp?p=preview
I have a flexbox container containing two flex items ("header" and "content"). The content div has a single child div that I want to control the height of. But no matter how I set the height of this div, the height stays default.
Here's the markup / CSS:
<!DOCTYPE html>
<html>
<head>
<style>
div { padding:15px; }
.container
{
background-color:gold;
height:500px;
display:flex;
flex-flow:column nowrap;
}
.header
{
background-color:pink;
/* no flex shrink/grow */
}
.content
{
background-color:aquamarine;
flex:1 1;/* allow filling space */
}
.myContentItem
{
background-color:khaki;
display:block;
height:50%;/* <-----------this is ignored */
}
</style>
</head>
<body>
<div class="container">
<div class="header">header<br />yo</div>
<div class="content">
<div class="myContentItem">I want this to be 50% the height of content div</div>
</div>
</div>
</body>
</html>
edit: I am aware that I could use display:absolute
to make it work in this contrived example. I'm more curious though why this happens, and how to deal with it in a proper way instead of finding a workaround.