Div box height 100 percent in css

If you want to set height 100% in any box then you need mandatory set your body & html height 100%. And go to set your container height 100%.

<!DOCTYPE html>
<title>HTML Tutorial</title>
    *{ margin:0; padding:0;}
    html,body{ height:100%;}/* this height is important*/
    .heightMainBox{ height:100%; background:#ccc; max-width:1000px; margin:0 auto;}/* this height is important*/

<div class="heightMainBox">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>


No comments:

Note: Only a member of this blog may post a comment.

Copyright Reserved to Anything Learn. Powered by Blogger.