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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Div won't center

    Hi! I'm working on my portfolio and have a problem...

    The menubar won't get into the center! Check http://seer.se and see the column with "1, 2, 3, Hem, Sebastian, Kontakt". It should be just down under the header.

    I think this problem is out of my knowledge since I really am an amateur at this so I would be so glad if someone could help me with it.

    // S

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello seer,
    To center an element you need three things:
    1. a valid DocType
    2. an element with a width
    3. that elements right/left margins set to auto

    Right now, your #header and #info are full width elements. #header is centered by the background properties you put on it.
    #info might be centered like this:
    Code:
    #info {
    background: #fff;
    margin: 120px 0 0 -190px;
    position:fixed;
    height: 30px;
    left: 50%;
    }
    This would work if you got #header and #info out of#content -
    Code:
    #wrapper {
    clear:none;
    margin: 0px auto;
    padding: 0px;
    width: auto;
    height: 715px;
    overflow: auto;
    }
    #info {
    background: #fff;
    display: table-row;
    margin-top: 150px;
    margin-left: auto;
    margin-right: auto;
    display: block;
    width: 300px;
    height: 30px;
    text-align: center;
    }
    Last edited by Excavator; 11-06-2011 at 03:03 AM.
    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

  • Users who have thanked Excavator for this post:

    seer (11-06-2011)

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ah, allright! Thank you so much!


  •  

    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
    •