Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Center Website with Div Tag Re: Center Website with Div Tag

#68531
rickylamerz
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)