views:

9

answers:

1

I want my page to be centered in the users screen,say with width of 800px. How do I ensure that the div tags left and top attributes adjust correctly based on the users screen resolution?

A: 

For the left and right margins do auto. For top and bottom you'll need some js to make sure it's positioned perfectly and it doesn't change ased on browser.

.object {margin:20px auto;}

That will set the top and bottom margin to 20px and the left and right margin to automatic.

Here's a cool way to do both: http://www.hicksdesign.co.uk/journal/vertical--horizontal-centering-2

Dave Merwin