Centering a fixed width body in the browser window?

Discussion in 'CSS' started by AaronCPK, Feb 13, 2007.

  1. #1
    Hi, quick question:

    I'm trying to figure out how to center my content in a browser window, while keeping the width fixed at a certain number of pixels.

    My site is HotRodKush.com if you want to take a look, right now it's all on the left side.

    Here's my current CSS for the body and paragraphs:

    body {width: 775px;margin: 50px;background-color: black;color: #999999;font-family: sans-serif}


    p {line-height: 125%;margin: 35px;font-size: 14px}


    Should I just place everything in a table and center-align the table? There's got to be a way to do it in my CSS file though, instead of making tables on all of my pages, no?
    Thanks,
    Aaron
     
    AaronCPK, Feb 13, 2007 IP
  2. MrX

    MrX Well-Known Member

    Messages:
    1,563
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    140
    #2
    margin-left: auto;
    margin-right: auto;
     
    MrX, Feb 13, 2007 IP
  3. AaronCPK

    AaronCPK Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Awesome, thanks, don't know why I didn't try that.
     
    AaronCPK, Feb 13, 2007 IP