Home › Forums › CSS › Centering a web page…again and again. › Re: Centering a web page…again and again.
March 9, 2012 at 3:41 pm
#98630
Participant
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.