Home › Forums › CSS › Center Website with Div Tag › Re: Center Website with Div Tag
December 27, 2010 at 12:07 pm
#68531
Member
What I would do to center a Div absolutely is:
#divselector {margin:0px auto; width:800px;}
And if for some reason that doesn’t work. You could always try:
#divselector {position:absolute; left:50%; width:800px; margin-left:-400px;}
You absolutely position it in the center by giving in a negative margin of half the total width.
(I’m assuming in this example that the div is 800px wide)