Connecting Tech Pros Worldwide Help | Site Map

Floating text on wrapped line

  #1  
Old October 31st, 2008, 11:35 PM
Jason Carlton
Guest
 
Posts: n/a
I have a bit of text that has a varying length, and I'm wanting to
float text to the right. The problem is that the text needs to wrap to
2 lines instead of 1, and I'm wanting to float the text to the right
of the second line.

Something like this:

blah blah blah blah blah blah blah blah blah
blah blah blah... floated text

(If that doesn't show up correctly, I have 23 whitespaces between
"..." and "floated text")

I'm chopping the text at 75 characters and adding the ... myself, so I
know that the total length of blah blah will be 75 characters or less.
But I have no way of knowing if the top line will be 40 characters, 45
characters, or what, before it wraps.

I originally thought that this would work:

<div style="float: left: width: 80%">blah blah...</div>
<div style="float: right: width: 20%">floated text</div>

But this makes the top line wrap at 80%, too, where I only want the
second line to be 80%. I want the floated text to be aligned directly
beneath the last word of the first line.

The only solution I can think of is to go to the 50th character, then
go back to the last whitespace and chop from there, so that there
would be a variable on line 1 and a separate variable on line 2.
Something like:

$var1 = "blah blah blah blah blah blah blah blah blah";
$var2 = "blah blah blah...";

$var1
<div style="float: left: width: 80%">$var2</div>
<div style="float: right: width: 20%">floated text</div>

This should float correctly, but is there an easier way?

TIA,

Jason
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Floating text on wrapped line Jason Carlton answers 2 October 31st, 2008 11:55 PM
fgets() - supposed to be simple :) Rob Somers answers 5 November 13th, 2005 11:15 PM
help formatting list of checkboxes (works ok in Opera and IE, not FF) Timo answers 6 July 21st, 2005 03:00 AM
Can somebody hold my hand? lostinspace answers 6 July 20th, 2005 10:00 PM