Include the doctype and add this to your CSS:
html, body { height: 100%; }
When using percentage heights, you must specify a height for all parent elements up to and including the root element. Read more here:
- Working with the CSS height property and percentage values
When you remove the doctype the browser enters quirks mode and resolves an element's percentage height relative to the viewport when the parent's height is auto
. Read more here:
- CSS height property, percentage values & DOCTYPE