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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aligning text problem

Status
Not open for further replies.

BG12424

Programmer
Jun 4, 2002
717
US
I have a situation where my text within a TD tag is wrapping under the image when I want it to actually wrap and start under the previous line. The best way to explain this is with some code I have as an example:

<td><img src=&quot;img.gif&quot;>  Text information that I want to wrap, but not under the graphic</td>

so, what I get looks like this:
GRAPHICFILE Text information that I want
to wrap, but not under the graphic

where I want to have this:

Code:
GRAPHICFILE Text information that I want 
            to wrap, but not under the graphic

Is there a way that I can handle this with a div or span tag (or something other than creating an inner table, then separating out the graphic and text in their respective TDs? Thanks

regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.
 
Try this:

Code:
<div style=&quot;height:80px;&quot;>
<div style=&quot;float:left;&quot;><img src=&quot;[URL unfurl="true"]http://www.tek-tips.com/art/site/partner.gif&quot;></div>[/URL]
<div style=&quot;margin-left:140px;&quot;>Insert text here. </div>
</div>

It's not perfect because you need to know the width and height of the image. In this example I took the width of the image (120px) and added a 20px border to it (hence the margin-left:140px). I added 20px to the height as well to preven the outer div from shrinking too much (hence the height:80px).

See how you go. I hope you can build on it.

Jeff
 
I would insert a column.

<td><img src=&quot;graphicfile&quot;></td>
<td>Text information that I want to wrap, but not under the graphic</td>

You may need to change a setting in your other rows to allow for the new column. <td colspan=2>

You could also nest a table but I don't think it's necessary with the info you provided.

Good Luck,


Wow JT that almost looked like you knew what you were doing!
 
pixl8r...

something other than creating an inner table, then separating out the graphic and text in their respective TDs

It's dead simple with a table... but that wasn't the requirement. Although I would be interested exactly *why* that was a requirement (just out of curiousity).

Have a great weekend...
Jeff
 
Jeff,

I did realize that he said he didn't want to use an inner table (which I took to mean nested table), so my example was how to do it with the existing table.

Point being you don't have to use a nested table in this case to accomplish the goal.

Of course your method would work perfectly well also!

I also wonder why the requirements are as they are?

Wow JT that almost looked like you knew what you were doing!
 
It's not a requirement, just playing around with some css stuff. I haven't gotten around to try the attempt by Jeff, but it looks doable right now.

regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top