Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

left align and right align in the same cell 2

Status
Not open for further replies.

44nato44

Programmer
Dec 12, 2008
115
NL
I am not sure if this is possible, but I have a picture and text in a cell where I would like to have the picture on the left side of the cell and the text on the right side.. the size of the text can varie.

I am not that much of an expert with CSS, hope somebody can help me.

Cheers
 
If you don't want to use FLOATs, you could create two child elements within the CELL and align them as required e.g. :

Code:
<TD STYLE="border:2px black solid;width:600px">
    <SPAN STYLE="align:right">
        <img src="[URL unfurl="true"]http://www.tek-tips.com/images/header-logo.gif">[/URL]
    </SPAN>
    <SPAN STYLE="align:left;vertical-align:top">
        This is the accompanying text for this photo
    </SPAN>
</TD>

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
Why are you using a table?

In any case the correct property is text-align, and no it won't work in this case because it aligns the text inside the element who's property you are setting. So in this case it aligns the text to the left or right inside the span its in. But since the span is tightly wrapping around it you can't see the effect nor is it the effect you want.

I'd say floating would be a good alternative in this case.
Code:
<span style="float:left;">

Other than that, perhaps floating just the image and setting the text-align property of the table cell to the opposite direction may also work.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
This is part of a dynamic table, where I wanted to add a picture if a certain condition was met.

thanks a lot
 
Ahh I see.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
No Prob.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top