Vertical Align Div Contents

Discussion in 'CSS' started by megacontent, Apr 2, 2009.

  1. #1
    What's the best way to:

    vertically align the contents of a div so they show up in the center?
     
    megacontent, Apr 2, 2009 IP
  2. Somesite

    Somesite Peon

    Messages:
    152
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm unsure what you mean here, but I'll go ahead and make assumptions... here's a few ways I center text within divs...

    <div style="margin: 0 auto; width:450px(or however wide you wish your content to be);"></div>
    or
    <div style="text-align:center;"></div>

    If I got this all wrong, because it's not what you're looking for, please add some more details ^_^
     
    Somesite, Apr 3, 2009 IP
  3. megacontent

    megacontent Guest

    Messages:
    231
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm referring to the contents of the div being vertically aligned.
     
    megacontent, Apr 3, 2009 IP
  4. thr3146

    thr3146 Active Member

    Messages:
    182
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #4
    valign="top" ???
     
    thr3146, Apr 3, 2009 IP
  5. Oxi

    Oxi Peon

    Messages:
    78
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Oxi, Apr 3, 2009 IP
  6. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #6
    Rather than give all the different anwers for the different scenarios, what is the content? A <p>? A <img>?
     
    drhowarddrfine, Apr 3, 2009 IP