html - CSS position absolute content area not growing -


i trying create html of design. stuck 1 issue. css n html structure image have attached here. want footer in bottom of page content area when grows should push footer down. if there no content content area should till footer. content area coming on header , footer area. don't know if structured right.

enter image description here

    <html xmlns="http://www.w3.org/1999/xhtml">     <head> <style> html, body { height:100%;} body {     background: #ebebeb;     margin: 0px;     padding: 0px; } #wrapper {     width:100%;     height:100%;     margin: 0 auto;     position:relative; } #header {     width:100%;     height:147px;     background:#999;     border-bottom:solid 5px #ddd;     position:absolute; } #footer {     bottom:0;     width:100%;     height:170px;     position:absolute;     background-color:#ccc;     border-top:solid 5px #ddd; } #contentarea {     width:300px;     max-height:100%;     position:absolute;     z-index:999;     left:0;     right:0;     top:0;     bottom:0;     margin-left:auto;     margin-right:auto;     margin-top:120px;     margin-bottom:100px;     background:#fff;     border:solid 1px red; } </style </head>  <body>  <div id="wrapper">     <div id="header">header</div>     <div id="footer">footer</div>     <div id="contentarea">         lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, when unknown printer took galley of type , scrambled make type specimen book. has survived not 5 centuries, leap electronic typesetting, remaining unchanged. popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing software aldus pagemaker including versions of lorem ipsum.  lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, when unknown printer took galley of type , scrambled make type specimen book. has survived not 5 centuries, leap electronic typesetting, remaining unchanged. popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing software aldus pagemaker including versions of lorem ipsum.      </div> </div>  </body></html> 

check code here.

you can use magrin that!
, advice: use postition:relative; main sections!

<html>   <head>     <style>     *{         font-family:"trebuchet ms", helvetica, sans-serif;         text-align:center;     }     #header,#footer{         position:relative;         height:150px;         background:#ccc;         border:solid 1px #bbb;     }     #footer{         bottom:0;     }     #body{         position:relative;         margin-top:-50px;         margin-bottom:-50px;         min-height:250px;         background:#aaa;         width:70%;         margin-right:auto;         margin-left:auto;         padding:50px 15px;         box-shadow:0px 0px 10px 1px #aaa;         border:solid 1px #999;         opacity:0.92;         z-index:999;     }     </style>   </head>   <body>     <div id='header'>         header     </div>     <div id='body'>         body     </div>     <div id='footer'>         footer     </div>   </body> </html> 

http://jsfiddle.net/mostafaznv/2zfjc/


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -