Center Content Vertically Using CSS

July 7th, 2007

Use absolute positioning and negative margins to get that box centered vertically! You must declare the height of the DIV you are centering, as your negative top margin will be half of this value.

Example here : http://greystonbakery.com/

div#landing-wrapper {
margin-left:-324px;
margin-top: -222px;
position:absolute;
top: 50%;
left: 50%;
width:648px;
height:444px;
}