Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to vertically align images in <td>

Tags:

html

css

I got a <td> where two images () reside shown as follows. One is much higher than the other. How do I let the shorter one align to the top of <td />?

<td  style="padding-left: 0px; cursor: pointer; vertical-align: top;">
<img width="85px" src=".../xyz.png"/>
<img src=".../icon_live.gif" /> // shorter one
</td>
like image 476
Ricky Avatar asked Mar 16 '10 05:03

Ricky


2 Answers

You need to set vertical alignment on the images themselves.

<style>
td img { 
  vertical-align: top;
}
</style>
like image 93
Shawn Steward Avatar answered Oct 06 '22 03:10

Shawn Steward


This did the job for me:

#logo-table td img, #logo-table td
{
    vertical-align: middle;
}

In html:

 <table id="logo-table">
      <!--table contents with imgs-->
 </table>
like image 22
Siroj Matchanov Avatar answered Oct 06 '22 03:10

Siroj Matchanov