Help me...Please

Discussion in 'HTML & Website Design' started by eranga1913, Apr 6, 2010.

  1. #1
    How to center CSS web site?
    I design my site using layers, but it is always goes to left side of the screen. What is the best way that I can do it easily?
     
    eranga1913, Apr 6, 2010 IP
  2. PsyHost

    PsyHost Well-Known Member

    Messages:
    641
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Im not the best with CSS, but i think setting a margin should center your website.

    ie:
    * {
    margin: 0 auto;
    }

    Correct me if im wrong.
     
    PsyHost, Apr 6, 2010 IP
  3. damienallen

    damienallen Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That will work, but I'm pretty sure that you would need to specify a width as well.
     
    damienallen, Apr 6, 2010 IP
  4. bobjutsu

    bobjutsu Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You do need to specify a width, and apply it to a block level element (e.g., a div)

    the "*" selector is a universal selector, and will apply to all elements, meaning, unless otherwise specified in the stylesheet, all block level elements will have a default margin of 0 auto; if you use the * selector.
     
    bobjutsu, Apr 7, 2010 IP
  5. moodey-aimee

    moodey-aimee Guest

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you have the layout of the css in a container, put it in the container div tag. I think, I'm still learning

    #page {background-color: white;
    border: solid 3px #000;
    margin: 0 auto;
    padding: 2px;
    width: 900px}
     
    moodey-aimee, Apr 7, 2010 IP