AiJahya
08-12-2004, 01:09 AM
Is there a way to center the entire page on a div layout?
|
View Full Version : Centering an entire div/css layout? AiJahya 08-12-2004, 01:09 AM Is there a way to center the entire page on a div layout? kittycat 08-12-2004, 01:36 AM First off you would have to remove all absolute positioning. Then add text-align: center; to the body section of your CSS. [For a simple header, single div below it] To each div add margin: auto;. If you want to change the distance it's spaced from the top of the page/div above, add margin-top: ##px; as well. [For a header with multiple divs below it] Add margin: auto; to the header. Create a new div that will contain all your other divs like this: #wrap { margin: auto; width: ##px; } (change width to combined width of your divs) Add float: left; to the div on the left and float: right; to the div on the right. Put your two divs inside the wrap div, so it looks like <div id="wrap"> <div id="left"> the left div </div> <div id="right"> the right div </div> </div> Hopefully that makes sense, tried to explain it the best I could... AiJahya 08-12-2004, 01:47 AM Thanks! :) |