/ Published in: CSS
the best solution for vertical align
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<div id=â€shimâ€/></div> <div id=â€wrapperâ€> Content </div> html, body { height: 100%; margin: 0; padding: 0; } * { margin:0px auto; padding:0; } div#shim { visibility: hidden; width: 100%; height: 50%; margin-top: -200px; float: left; } div#wrapper { width: 1000px; height: 400px; clear: both; background:red; position: relative; top: -200px; /* IE4ever Hack: Hide from IE4 **/ position: static; /** end hack */ } /* Hide from IE5mac \*//*/ div#shim { display: none; } html, body { height: auto; } /* end hack */ /* ]]> */
URL: http://stylizedweb.com/2008/02/01/vertical-align-div/