HTML CSS examples for CSS Widget:Footer stick to bottom
Center div in the middle of page with header and footer sticky to top and bottom of page
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,dl,dt,dd,ol,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td { margin:0; padding:0; border:0; outline:0; font-weight:inherit; font-style:inherit; font-size:100%; font-family:inherit; text-decoration:none<!-- www . j a v a2 s . co m--> } :focus { outline:0 } a:active { outline:none } body { line-height:2; color:Chartreuse; background:white } table { border-collapse:separate; border-spacing:0 } caption,th,td { text-align:left; font-weight:normal } blockquote:before,blockquote:after,q:before,q:after { content:"" } blockquote,q { quotes:"" "" } html, body { width:100%; height:100%; margin:0; padding:0; } body { font-family:arial, sans-serif; font-size:15px; color:yellow; line-height:23px; text-decoration:none; } #outer { width:100%; background:blue; margin:-129px auto 0; height:100%; text-align:left; clear:both; display:table; position:relative; z-index:2; } #header { width:100%; margin:auto; background:black; height:67px; position:relative; z-index:3; border-bottom:21px solid pink; } #footer { background:black; width:100%; margin:auto; height:23px; clear:both; border-top:21px solid OrangeRed; position:relative; z-index:3; } #content { vertical-align:middle; display:table-cell; padding:129px 0 0; } #content .inner { background:blue; padding:0 11px; width:301px; height:201px; margin:0 auto; } * html #outer { height:100%; } * html #content { top:51%; position:relative; width:100%; float:left; } * html .inner { top:-51%; position:relative; } *+html #outer { height:auto; min-height:100%; } *+html #content { top:51%; position:relative; width:100%; float:left; } *+html .inner { top:-51%; position:relative; } </style> </head> <body> <title>Lorem ipsum dolor sit</title> <meta http-equiv="Content-type" content="text/html; charset=UTF-8"> <div id="header"> Lorem ip </div> <div id="outer"> <div id="content"> <div class="inner"> Lorem ips </div> </div> </div> <div id="footer"> Lorem ip </div> </body> </html>