I have a layout with a top section which can grow in height, and a content section below which contains a chart. The basic HTML structure can be characterized as:
<div class="wrapper">
<div class="top">
<span class="box">Box 0</span>
<span class="box new">
<button>+</button>
</span>
</div>
<div id="chart">
Chart
</div>
</div>
Each box element is a fixed width and height, and is a fluid design so that as the boxes cannot fit onto the same line, they wrap round to the next, making their container (top) grow.
Here is an interactive demo at this stage: http://jsfiddle.net/d1d6bwbc/ where you can see that the wrapper is 100% width & height (red border). The top has a magenta border, and grows as the boxes need to wrap and the chart has a blue border.
I am trying to make that chart element fill 100% of the remaining height in wrapper.
Here is my css so far
body{margin:0}
.wrapper{
position:absolute;
border:1px solid red;
height:calc(100% - 2px); /* account for border in this example */
width:calc(100% - 2px); /* account for border in this example */
}
.top{
border: 1px solid magenta;
padding-bottom:5px
}
#chart{
border: 1px solid blue;
/* style chart to fill 100% of wrapper
}
I have tried numerous css hacks and tricks, such as those found in this question and this one too but they do not seem to work on my layout.
I have complete control over the layout so if my markup requires some work that will be fine, but a simple way to achieve a fill on that chart element is what I'm after.