I am putting together a website for a non profit, i have dreamweaver cs4 which is really helpful. I just cant seem to figure out how to have the webpage centered on the screne.. it looks good on my computer, but when i have my friend log on to the website, (from a different computer) the page is all the way to the left... if anyone has any codes or suggestions I would really appreciate it!!....
Generally the way to center your content is to wrap everything in a div. Ex: <div id="mainWrapper"> ---All your page content inside your <body> tags goes here--- </div> Code (markup): And then apply margin-left and margin-right like so: #mainWrapper{ margin-left: auto; margin-right: auto; } Code (markup):
the page comes in the center even if u not give margin-left:auto; margin-right:auto; but only in internet explorer , as other browsers like firefox u have to give #main{ margin-left: auto; margin-right: auto; } in the main div inside which u r taking all the divs. Hope this will help.
Awesome... thanks for the responce. hopefully I can make this work, if not i will ask more questions... thank you
You could also use the shorhand for the margin CSS. #main {margin: 0 auto} Code (markup): The first number (0) gives the margin on the top and bottom of the element, and the second (auto) is for the right and left of the element. With auto there, the container should be centered.