tutorialtastic

absolutely centered

#nameofdiv {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 300px;
	height: 200px;
	margin-left: -150px;
	margin-top: -100px;
}

1. Set the margin-left to a negative number half of your width
2. Set the margin-top to a negative number half of your height

Change the width and height to your needs. You can also change the measurement units. Just remember to edit the margins accordingly.

Category: CSS
Rating:
Added: 23rd November 07 by beneton
Bookmark At: StumbleUpon, Digg

tutorialtastic — ultimately better than pixelfx
Copyright © Jem Turner 2003-08. (About | Disclaimer | Link In)