Results 1 to 3 of 3

Thread: Centering using <Container> scripting

  1. #1
    Join Date
    Dec 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Centering using <Container> scripting

    Okay... so I'm having a go with creating a two column webpage using css and who knows how long it's been since I've played with CSS. Well. I'm trying to center the entire page (along with the top portion staying in alignment) but have not been able to figure it out. I've read several tutorials about the whole container scrip but it seems alien to me.

    http://zero_monolith.sitesled.com is the site under investigation. Any help would be greatly appreciated.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The basic idea is to not mess with the body's margin other than to zero it out if desired. You can use a container division with a unique id that holds all the content on the page:

    HTML Code:
    <body>
    <div id="containerdiv">
    all content here
    </div>
    </body>
    Use a valid DOCTYPE and avoid all absolute and relative positioning and floats in the content unless you know what you are doing with them. Pick a width for the container - say, 775px, set its style like so:

    Code:
    #containerdiv {
    width:775px;
    margin:0 auto;
    }
    As long as no individual element in the content is greater than that width and all content can wrap if it needs to, that will center it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Be aware that the style sheet you attempt to import, all.css, doesn't exist.

    Your server misbehaves, here: rather than returning a 404 File Not Found response, it returns a 302 Found redirect that leads to a 200 OK response that pretends to be a 404 document. Status codes should be accurate and actually report the condition. Neither of the received responses are correct.

    Mike

Bookmarks

Posting Permissions

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