tags:

views:

14

answers:

2

I have an image and text beside it with this code. A sample can be seen here:

alt text

The problem is that the text is starting from the center of the image (on the right side) whereas i want the text to start from the top right-hand side of the image.

Here is my code:

<table width="550">    
<tr>   
<td>   
<div id="i1">   
<img src="<? echo $row_array[3];?>" height="225" width="225">   
</div>   
</td>   
<td>   
<div id="i2">   
<span style="position: relative; top: 0px; left: 0px;">       
<? echo  $row_array[4];?>   
</span>   
</div>   
</td>   
</tr>   
<tr></tr>   
<?} ?>   
</table>

I have even tried to remove span but it still shows the same way.

i1 in css: margin-left:0px;
i2 in css:
#i2 { display: inline; margin: 0px 0px 0px 0px; padding:0px 0px 0px 0px; }

A: 

Add valign="top" attribute to the <td> that contains the text.

aularon
A: 

I think, unless I'm missing something, that the following should achieve your aims:

td {
    vertical-align: top;
}

This will obviously apply to all tds, so you may wish to specify a particular class or id.

David Thomas
thanks. it worked.
Scorpion King
No problem, glad to be of help =)
David Thomas