Hey all. I got my last problem with the aligning fixed with all my graphics on my page, now I just have a quick question. Can anyone tell me how to center everything in the body? I'm not sure how to explain, but all my pages contain a php include to a page that contains the navigation, ads, layout, etc. I would like to get everything centered without having to change everything on every page, and since I use absolute positioning on things like the position of my navigation, search box, etc, centering it would bring everything out of line when the window size changes. Any help would be awesome!
url please ,.. so we can learn together what need to change. One suggestion for centering the div : use css auto margin usually i used : margin: 0 auto; Code (markup): Well, is just one of centering tips for specific used. I dont know what you need in specific by the way
I need to do it so that it takes everything you see and just put the whole thing in the middle of the page. Because I have multiple pages and all have a php include that contains the seperate php includes such as my navigation, etc, I probably would need to have it there, but so that all of the text from my other pages will go in the right spot as well. All of the text in the other pages use an absolute position and use <div=content> which is assigned specificly, so I need something to center it too without changing it's relation to the layout
To center, I put everything inside of two divs: #wrapper {position: relative; width: 990px; margin: 0 auto; text-align: left; background-color:#000000;} #main { position: relative; top: 0px; left: 0px; width: 990px; margin: 0; padding: 0; } Code (markup): That will give you a 990 wide box, centered in the bod to work with
- Don't use position:absolute on layout. - margin:0 auto may not work on the elements with position:absolute
okay, that got my navigation, layout, and ads centered without messing it up...but now there's some more problems. my layout is nudged down a little bit (was a problem before) and the background has been a little screwy (there's a small white line between the layout picture and where the bg begins. i still need to know a way to get my "content" div to align right with the rest of the layout along with removing that little space at the top of my layout. almost there! edit: bleh, now all the other pages are different - everything is jambled up. if i can't find a fix ill just go back to the way it was
You must align each DIV elements in the body . Alternatively you can add a class attributors to the DIV elements in the body, So you can align all elements in one time. Css code is margin: 0 auto;