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
    Jan 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Center entire page in browser

    How can I center a fixed width page in the browser window without tables?

    I've tried the fixes in existing posts, but they don't seem to do it here.

    page is at www.mymangosteencards.com

    Thanks

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello passingthrough,
    Your on the right track by using margin left/right auto and using a doctype... it's trying to center your #content but the 1800px width is just too wide.
    Narrow that down to 900px or so and see -
    Code:
    div#container
    {
       width: 900px;
       position: relative;
    margin: 0 auto;
    background: #000;
    height: 3000px;
       text-align: left;
    }
    There is still plenty of other problems though. All the absolute positioning is really messing things up. Try removing the height:3000px; and you'll see the black background disapear.

    Run your code through the validator and see if fixing as many errors as you can doesn't improve things - see my suggestion and links about validating in my sig below.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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