Centering a title?

Discussion in 'CSS' started by le007, Apr 29, 2009.

  1. #1
    Hi all - trying to center some text in a wrapper of width 900px
    .name {
    position: absolute;
    top: 10px;
    width: 900px;
    margin: 0 auto;
    padding-left: 0px;
    font-family: impact; 
    font-size: 2.5em;
    font-weight: bold;
    color: #DD6E05;
    }
    Code (markup):
    Not working - any ideas please?
     
    le007, Apr 29, 2009 IP
  2. javaongsan

    javaongsan Well-Known Member

    Messages:
    1,054
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #2
    add

    text-align: center;
    Code (markup):
     
    javaongsan, Apr 29, 2009 IP
  3. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #3
    Worked a charm - thanks buddy :D
     
    le007, Apr 29, 2009 IP
  4. usadesi

    usadesi Peon

    Messages:
    296
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thanks for....
     
    usadesi, May 6, 2009 IP
  5. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I suppose you were wondering why this part didn't work:

    
    width: 900px;
    margin: 0 auto;
    
    Code (markup):
    The answer is, because you absolutely positioned it. Give that thing a border, and you will see, if its container is wider than 900px, the header itself isn't centered, but the text inside it is.
     
    Stomme poes, May 7, 2009 IP