Forum Moderators: not2easy

Message Too Old, No Replies

How to right align an image inside a table cell?

trying to get an image to be justified to the right side of a table cell

         

busquelo

3:50 pm on Oct 6, 2006 (gmt 0)

10+ Year Member



Hello,
I am struggling with the following css issue:

I am trying to get an img element inside a <td> cell to align to the right hand side of the cell. How can I do this?

I tried this but it doesnt work.

<td colspan='15' class='resSingle' >
Here is some test text
<img src="//some url" style="position:relative;right:0px" />
</td>

Any suggestions?

Thanks
Nat

DanA

4:16 pm on Oct 6, 2006 (gmt 0)

10+ Year Member



Did you try

<td colspan="15" class="resSingle">
<span style="float: left;">Here is some test text</span>
<img src="//some%20url" style="float: right;">
</td>

bedlam

4:24 pm on Oct 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The span in this code:

<td colspan="15" class="resSingle">
<span style="float: left;">Here is some test text</span>
<img src="//some%20url" style="float: right;">
</td>

...is totally unnecessary for such a simple task. There's no need that I can see to alter the original markup; adding one line to the css file will suffice:

.resSingle img { float:right; }

-b

busquelo

7:25 pm on Oct 6, 2006 (gmt 0)

10+ Year Member



thanks, that worked!

Reysbro

6:16 am on May 17, 2008 (gmt 0)

10+ Year Member



Thanks