PDA

View Full Version : Aligning DIVS..


geek
02-23-2005, 12:40 PM
Lets say i have about 30 DIV's on my site. I want the page to be center aligned. Is there a way i can just align the whole thing to the center, or do i have to go in and individually re-locate each div?

chilipie
02-23-2005, 02:36 PM
30 divs! What do you want that many for? Even some of my more complex designs have only used 4/5 <_< . To answer your question, you can put a wrapper/container around your divs. I guess you know where the HTML/CSS goes, so I'll only post the relevant code.

#wrapper {
width: /* width of div */;
margin: 0 auto;
}

.....

<div id="wrapper">

<!-- 30 odd divs go here -->

</div>

And that's all there is to it :P .

DrWolfgangVonBubbles
02-23-2005, 02:46 PM
I am not very good at CSS but couldn't you just add the center thing to the body part of the style sheet?

chilipie
02-23-2005, 05:01 PM
Originally posted by DrWolfgangVonBubbles@Feb 23 2005, 03:46 PM
I am not very good at CSS but couldn't you just add the center thing to the body part of the style sheet?
28959

Don't quite know what you mean...

DrWolfgangVonBubbles
02-23-2005, 05:15 PM
Something like...

body {align: center}

geek
02-23-2005, 05:34 PM
no, that would just center align each div. I have divs next to each other, and i need it centered as if it were on div. I'll try what chili Pie said