Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to center my webpage ?

    Hello,

    I am having difficulty aligning my website correctly. The problem is that I have set up margins for the div tags and the auto margin doesn't work. Is there an easy solution to fix this issue.

    Below is the link to the website.


    http://grabbanddurando.com/gdpublic/

  • #2
    Regular Coder
    Join Date
    Feb 2012
    Location
    Nebraska, USA
    Posts
    132
    Thanks
    8
    Thanked 19 Times in 19 Posts
    Hello Rotexhawk!

    Welcome to CodingForums.com, we're glad to help

    It's never too late to use auto margins! All you need to do is create a container that sits outside all of your content (so it includes your #top and #footer). Then just apply the centering properties to the container

    HTML
    Code:
    <div id="centered-container">
       (all of your current body content)
    </div>
    CSS
    Code:
    #centered-container {
    	width:960px;
    	margin:0px auto;
            overflow:auto;
    	}


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •