SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    vertically centre img next to other img

    I'm sute this is really easy but it's doing my head in!!

    I have one image which is 20px high and one which is 50px high. I want then side by side with the smaller one vertically centered to the larger one.

    cheers
    monkey - the rest is history

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,806
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    assuming they are in the same container img{vertical-align:middle;} should do the trick.

    hope that helps!

  3. #3
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dresden_phoenix View Post
    assuming they are in the same container img{vertical-align:middle;} should do the trick.

    hope that helps!
    Code:
    <div>
      <span style="vertical-align:middle"><img src="/images/pwl_title.gif" width="443" height="25" /></span>
      <img src="/images/pwl_logo.gif" width="522" height="115" />
     </div>
    does nothing! This is what i thought should work!
    monkey - the rest is history

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,806
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    You gave the SPAN the vertical align , not the IMG.

  5. #5
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,888
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Alternatively, if you know the heights of the two images, use position:relative; to move one of them by half-the-difference.

  6. #6
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dresden_phoenix View Post
    You gave the SPAN the vertical align , not the IMG.
    It's late, i'm tired and I've been doing this all day!! I knew i was doing something really supid!!

    Cheers for your help buddy!
    monkey - the rest is history


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •