Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aligning image to the top of a table cell

enter image description here

I'm designing a wordpress page inside of the wordpress editor, and I can't figure out how to get the grey image placeholder to align to the top of the table cell. As long as the text in the left cell doesn't go below the grey image, everything is fine. But as soon as the text gets below the bottom of the image, the image pushes down. Here's the code:

<table border="1">
<tbody>
<tr>
<td style="vertical-align: top;">
<img class="alignleft size-full wp-image-71" alt="webi" src="#" 
width="437"     height="114" />                                                                      
&nbsp;
<p>
SOME TEXT
</p>
</td>
<td style="width: 355px;">
<img class="alignright size-full wp-image-61"   alt="palvelut_kuvapaikka" 
src="#"  
align="top" width="355" height="355" /> 
 </td>
</tr>
</tbody>
</table>
like image 906
niGeLL Avatar asked Jan 09 '13 15:01

niGeLL


People also ask

How do you align an image in a table cell in HTML?

The <img> align attribute is used to set the alignment of an image. It is an inline element. It is used to specify the alignment of the image according to surrounding elements.

How do you align data on top of a table?

To place an item at the top or bottom of its cell, insert the "VALIGN=" attribute within the code for that cell. To vertically align an entire row (e.g., placing all data in that row at the tops of the cells), insert the "VALIGN=" attribute within the code for that row.

How do I center an image in a table cell in Word?

The Table Options dialog box. Set the Top, Bottom, Left, and Right controls to 0 and feel free to clear the Automatically Resize to Fit Contents check box. Click OK, and these formatting settings are applied. Your graphic should now be exactly centered in the cell.


1 Answers

Just set the vertical-align: top property on the right td as well?

like image 52
Christian Avatar answered Nov 15 '22 22:11

Christian