I want to create one 3-section column layout
Section 1: Header Section 2: a section of content that stretches from the beneth header to the start of the footer, which has its contents centered vertically and horizontally inside itel Section 3: The footer, which is always located at the bottom of the browser window.
Problem:
I cannot get the contents of a div to stretch it to the start of the footer. If I enter the height: 100% it automatically stretches to the end of the entire page.
I would also like to center the contents inside this middle div vertically and horizontally - although I have not tried to do this yet.
Also, I donβt understand why the background of the title text is not in color. even though subheader subkeys are encapsulated by a div heading that has a background color.
thanks!
http://jsbin.com/ixipug/1/edit
<!DOCTYPE html> <html> <head> <style type="text/css"> html { height: 100%; } body { height: 100%; margin-left: 20px; margin-top:0px; margin-bottom: 0px; } #containerHeaderContent { min-height:100%; height: auto; height: 100%; margin: 0 auto -1.5em; } .push { height: 1em; } .header { background-color: aqua; padding-top:20px; } .subheader-left { float:left; font-family: serif; font-size: 20px; text-align: left; } .subheader-right{ float: right; font-family: sans-serif; font-size: 12px; padding-right: 20px;} .middleSection { padding-top: 10px; clear:both; width:100%; height auto; background-color: #e8e7e7; } .bottom{ background-color: red; position: absolut; height: 1em; font-size: small; } .bottom-left { float: left; font: sans-serif; left: 20px; } .bottom-right { float: right; right: 15px; font-style: italic; color: #8e8e8e; font-size: 11px; } </style> <title>XYZ</title> </head> <body> <div id="containerHeaderContent"> <div class="header"> <div class="subheader-left">XYZ</div> <div class="subheader-right">LOREM</div> </div> <div class="middleSection">Content Vertical and Horizontally Centered inside DIV</div> <div class="push"></div> </div> <div class="bottom"> <div class="bottom-left"> <span class="about"> <span class="bold">XYZ</span> is a project by XZY. | <span="address">Website Information</span> — <a href="mailto: info@info.eu "> info@info.com </a> </span> </div> <div class="bottom-right"> <span class="openinghours">Open by Appointment</span><span class=""> sponsored by XYZ</span> </div> </div> </body> </html><!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <title>JS Bin</title> </head> <body> </body> </html>
source share