Descriptive Plunker: http://plnkr.co/edit/remH1RtkY1qBk0A7J4Tp?p=preview
I have a flexbox container containing two flex elements ("header" and "content"). The content of the div has one child div, which I want to control the height of. But no matter how I set the height of this div, the height remains by 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;
}
.content
{
background-color:aquamarine;
flex:1 1;
}
.myContentItem
{
background-color:khaki;
display:block;
height:50%;
}
</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 know that I could use display:absoluteit to work on this contrived example. I'm more curious about why this is happening and how to handle it properly, rather than looking for a workaround.
source
share