.center-div { height:100px; width: 100px; position:absolute; top:50%; left:50%; margin: -50px 0 0 -50px; }
This can be modified for the 'centering at the bottom of the page' example, but with more efficient code.
More challenging is centering the unknown: http://css-tricks.com/centering-in-the-unknown/
.center-div { height:100px; width: 100px; position:absolute; top:50%; left:50%; margin: -50px 0 0 -50px; }
This can be modified for the 'centering at the bottom of the page' example, but with more efficient code.
More challenging is centering the unknown: http://css-tricks.com/centering-in-the-unknown/