/ Published in: CSS
For sites width fixed width and height centered in the screen.
Tested on ie6+, ff3+, opera (buggy, but it works), chrome 2, safari 4.
Remember to use a reset.css: the margin / padding of html and body must be zero.
Tested on ie6+, ff3+, opera (buggy, but it works), chrome 2, safari 4.
Remember to use a reset.css: the margin / padding of html and body must be zero.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
html, body{ height:100%; } .siteWrapper{ height:100%; letter-spacing:-1ex; word-spacing:-1ex; text-align:center; white-space:nowrap; font-size:0; } .alignReference, .siteAligner{ display:inline-block; #display:inline; #zoom:1; letter-spacing:0; word-spacing:0; font-size:12px; vertical-align:middle; } .alignReference{ height:100%; width:1px; overflow:hidden; margin-left:-1px; visibility:hidden; } .siteAligner{ text-align:left; } .siteHolder{ border: 1px solid red; position:relative; white-space:normal; } /* html code */ /* <div class="siteWrapper"> <div class="alignReference"></div> <div class="siteAligner"> <div class="siteHolder"> teste 123 </div> </div> </div> */