Return to Snippet

Revision: 24475
at March 2, 2010 09:43 by mariusscheel


Updated Code
.vertical {
	width: 600px; /*--Specify Width--*/
	height: 300px; /*--Specify Height--*/
	position: absolute; /*--Set positioning to absolute--*/
	top: 50%; /*--Set top coordinate to 50%--*/
	left: 50%; /*--Set left coordinate to 50%--*/
	margin: -150px 0 0 -300px; /*--Set negative top/left margin--*/
}

Revision: 24474
at March 2, 2010 09:42 by mariusscheel


Initial Code
1
.vertical {
2
width: 600px; /*--Specify Width--*/
3
height: 300px; /*--Specify Height--*/
4
position: absolute; /*--Set positioning to absolute--*/
5
top: 50%; /*--Set top coordinate to 50%--*/
6
left: 50%; /*--Set left coordinate to 50%--*/
7
margin: -150px 0 0 -300px; /*--Set negative top/left margin--*/
8
}

Initial URL
http://www.smashingmagazine.com/2009/10/05/mastering-css-coding-getting-started/#CSS-Basics3

Initial Description


Initial Title
Complete Centered DIV (horizontal AND vertical alignment)

Initial Tags
center

Initial Language
CSS