/ Published in: CSS
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * IE7 and older - content will start at the top of the viewport. * * * The HTML markup * <body> <div id="body"> Content goes here </div> </body> */ /** * The CSS markup */ html, body { width:100%; height:100%; } html {display:table;} body { display:table-cell; vertical-align:middle; } #body { max-width:50em; margin:0 auto; }
URL: http://www.456bereastreet.com/archive/201103/flexible_height_vertical_centering_with_css_beyond_ie7/