centering text within left-aligned div?

Discussion in 'CSS' started by emptymirror, Jun 30, 2009.

  1. #1
    Hi,

    I need to align a narrow (about 100px) div against the left side of the page. But, the text within the div needs to be centered.

    I've tried everything I can think of, but the div always winds up being centered on the page.

    Any suggestions would be most welcome! Thanks so much.
    all best,
    Denise
     
    emptymirror, Jun 30, 2009 IP
  2. unigogo

    unigogo Peon

    Messages:
    286
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    unigogo, Jun 30, 2009 IP
  3. emptymirror

    emptymirror Well-Known Member

    Messages:
    367
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Hi unigogo,

    Thanks for your advice! I just tried the code you provided. But unfortunately it didn't work for me. It did float the div left. However the text wasn't centered, but rather up against the left margin.

    Any other ideas?

    Thanks again for your help!
    all best,
    Denise
     
    emptymirror, Jun 30, 2009 IP
  4. emptymirror

    emptymirror Well-Known Member

    Messages:
    367
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    110
    #4
    Never mind, I got it working. Thanks again.

    cheers!
    Denise
     
    emptymirror, Jun 30, 2009 IP