How do I horizontally align two elements in a given container?

Discussion in 'Web Design and Development' started by macaddict23, Feb 24, 2008.

  1. macaddict23 macrumors 6502

    macaddict23

    Joined:
    Jun 20, 2006
    Location:
    MacVille, USA
    #1
    These two elements have different heights and currently align at the baseline. I don't want that. What I want is for them to align horizontally. Thanks!
     
  2. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #2
    i'm pretty sure this code isn't W3C compliant, but i know it works... so maybe you might be able to use something like this:

    Code:
    <table width="100%" height="100%" border="0">
    <div>
    <tr>
    <td>content</td>
    </tr>
    </div>
    </table>
    
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    Can you elaborate on the situation? It's hard to figure out what you're wanting. If you have some sample HTML that you're dealing with that would be helpful in understanding.
     
  4. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #4
    Use the CSS vertical-align: middle property. Should work fine for what you seem to be trying to do.

    jW
     
  5. ChicoWeb macrumors 65816

    ChicoWeb

    Joined:
    Aug 16, 2004
    Location:
    California
    #5
    IE doesn't like vertical align. :(
     
  6. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #6
    True, but I don't like IE.

    I'm not sure the fixes for IE, I've never used the property, I just know of it.

    jW
     

Share This Page