Centering Div

19-07-2009

Very nice, crossbrowser method for div centering both horizontally and vertically.
Just use this css:

#centeringDiv {
  position:absolute;
  top: 50%;
  left: 50%;
  width:20em; /* width value */
  height:20em; /* height value */
  margin-top: -10em; /* minus 1/2 of your height */
  margin-left: -10em; /* minus 1/2 of your width */
}

Another smart centering option using float and clear.

No reaction yet.

Your opinion

:

:

:

Are you a human?
Are you a human?

: