I have a div ( #child ) that will not expand to the full height of its parent ( #parent ). I set the height for both html and body . It works if I set the parent height to 100%, but I want the parent to have the minimum height and the child to the full parent height.
HTML:
<html> <body> <div id="parent"> <div id="child"> <p>This area should be have the same height as it parent.</p> </div> </div> </body> </html>
CSS
html, body, header, h1, p { margin: 0; padding: 0; } html { background-color: #DDD; height: 100%; } body { background-color: #DAA; height: 100%; } #parent { min-height: 70%; height: auto !important; height: 70%; background-color: #AAD; } #child { height: 100%; width: 80%; margin: auto; background-color: #ADA; }
JSFiddle: http://jsfiddle.net/nxVNX/11/
source share