Forum Moderators: open

Message Too Old, No Replies

Align Picture to Top Within Table Cell

         

renet

7:44 pm on Sep 4, 2008 (gmt 0)

10+ Year Member



Hi..

I am needing a bit of help for some images and how they display on the page.

Right now this is 3 pictures across and the middle picture is centered in the middle of the cell. I would like the top of the middle picture to be at the top of the cell or even about 20px below the top of the cell. I've tried: vertical-align:top (within the <img src tag> and that did not work...

<p aligncenter><table border="0">
<tbody>
<tr>
<td>
<img src="examplenet/wp-content/uploads/2008/09/heron-ridge-1.jpg" alt="" width="240" height="339" hspace="10" vspace="3"/></td><td><img src="example.net/wp-content/uploads/2008/09/heron-ridge-2-300x187.jpg" alt="" width="300" height="215" hspace="10" vspace="3" /></td><td><img src="example.net/wp-content/uploads/2008/09/heron-ridge-3-240x300.jpg" alt="" width="240" height="333"; padding: 100px 100px 0 0;/></a></p>
</td>
</tr>
</tbody></table>

Thanks in Advance

mattglet

7:53 pm on Sep 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Put style = "vertical-align: top" in the TD tag you want aligned to the top.

In addition, you have 2 glaring issues with your HTML:
1) <p aligncenter> should be <p align = "center">
2) Your closing </p> tag is embedded within your <table> tags. You need to move it outside of the table.

renet

8:37 pm on Sep 4, 2008 (gmt 0)

10+ Year Member



Thank you Matt,

Does this look correct? With this the pic is still centered in middle instead of at top.

<p align="center"><table border="0">
<tbody>
<tr>
<td>
<img src="http://example.net/wp-content/uploads/2008/09/heron-ridge-1.jpg" alt="" width="240" height="339" hspace="10" vspace="3"/></td><td><img src="http://example.net/wp-content/uploads/2008/09/heron-ridge-2-300x187.jpg" alt="" width="300" height="215" hspace="10" vspace="3" "vertical-align: top"/></td><td><img src="http://cascadewest.localwebhost.net/wp-content/uploads/2008/09/heron-ridge-3-240x300.jpg" alt="" width="240" height="333"; padding: 100px 100px 0 0;/></a>
</td>
</tr>
</tbody></table></p>

regards

[edited by: tedster at 10:05 pm (utc) on Sep. 4, 2008]
[edit reason] use example.net [/edit]

tedster

10:06 pm on Sep 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It belongs in the <td> tag: <td style="vertical-align:top;">

renet

7:13 am on Sep 5, 2008 (gmt 0)

10+ Year Member



Ted,

That worked.. Thanks!