I've written the following jsfiddle which shows a simple layout with two elements.
http://jsfiddle.net/64kps/RUjj2
HTML
<div id="hello">hello hello hello hello hello hello hello</div>
<div id="donut">donut</div>
JavaScript
var hello = document.querySelector('#hello');
var donut= document.querySelector('#donut');
var resize = function (event) {
var helloHeight = window.getComputedStyle(hello).height
helloHeight = helloHeight.replace('px', '');
helloHeight = parseFloat(helloHeight);
donut.style.height = (window.innerHeight - helloHeight) + 'px';
};
window.addEventListener('resize', resize, false);
resize();
My Question
The yellow element stays fixed to the top and has a height of whatever it needs dependant on it's content (note that the height is not explicitly specified)
The red element takes the rest of the vertical space available to fill the window.
It's important to note that as the width of the window changes, the heights of both the yellow and red elements change.
I'm wondering if there is any way to achieve this using pure CSS and not having to use JavaScript?
Thanks