I made a web page using the divs, the problem that i'm facing is that i can't center it, the div's positions change from a screen to another I used this method: body {[/COLOR] [COLOR=#ff0000] margin:0 auto; [/COLOR] [COLOR=#ff0000] background-color:#333344; [/COLOR] [COLOR=#ff0000] } [/COLOR] [COLOR=#ff0000] [/COLOR] [COLOR=#ff0000]#vertical {[/COLOR] [COLOR=#ff0000] position:absolute; [/COLOR] [COLOR=#ff0000] top:50%; [/COLOR] [COLOR=#ff0000] left:0; [/COLOR] [COLOR=#ff0000] width:100%; [/COLOR] [COLOR=#ff0000] margin-top:-1050px; [/COLOR] [COLOR=#ff0000] text-align:center; [/COLOR] [COLOR=#ff0000] } [/COLOR] [COLOR=#ff0000] [/COLOR] [COLOR=#ff0000]#horizontal {[/COLOR] [COLOR=#ff0000] position:relative; [/COLOR] [COLOR=#ff0000] width:701px; [/COLOR] [COLOR=#ff0000] height:525px; [/COLOR] [COLOR=#ff0000] margin:0 auto; [/COLOR] [COLOR=#ff0000] background:#333344 url(back.jpg) no-repeat top left;[/COLOR] [COLOR=#ff0000] } Code (markup): But it didn't worked as well. I will appreciate it if any one could help Thank you for your time Cheers
i don't really understand what you are trying to say, so you just want to center 1 div? or do you wanna center #horizontal and #vertical?
I made many divs on the same page, and I need to put them all in one single div so all the divs will be on the center of the page I didnt know how to explain hope its more clear now. thank you for your reply dude, hope to hear from you
I'm doing one at the moment this is what I've done <html> <head> <style> body { text-align: center; margin: 0; padding: 0; background-color: #949599; } #wrapper { width: 950px; text-align: left; margin: 0 auto; border: 1px solid #66696D; background-color: #FCFAFA; padding: 0 20px 20px 20px; } </style> </head> <body> <wrapper> <!-- all content goes in here </wrapper> </body> </html> Code (markup):
this is what i do on my website: body { text-align: center; } #shell { text-align: left; width: 980px; margin: 0 auto; position: relative; overflow: hidden; } BODY will center the content on the page and then the SHELL div returns al the content to justify left. look at my site: golfersforeplay.com is that centering the same way as you are trying to do?
horizontal and vertical align a div on the page #wrapper { width: 701px; height: 525px; position: absolute; left: 50%; top: 50%; margin-left: -350.5px; margin-top: -262.5px; } just horizontal #wrapper { width:701px; margin-left:auto; margin-right:auto; } hope it helps... also you may need/want body,html {width:100%;height:100%; overflow:hidden;}