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

Home Forums CSS Centering a web page…again and again. Re: Centering a web page…again and again.


If you want to center everything vertically as well as horicontally you can wrap it in a div and give a div the style

#wrapper{position: absolute; margin: auto; left: 0; right: 0; top: 0; bottom: 0;}

If you have to scroll on your site you can put a wrapper around everything with the style of

#wrapper { position: static; margin-left: auto; margin-right: auto; }


But please be aware that absolute positioned and fixed elements won’t stick to the parent element.