Right justify last line of text?


My html code consists of a table.  In some of the cells I have text which almost takes up the whole cell.  I would like to add a link to the end of the text justified to the right on the same line as the last line of the text.

So it will be something like this:
text text texttext vtexttext text text v textvtext text v v vtext
texttex texxt                                                             link

I tried puting the link in a div with the display set to inline but I can't give it width.  The only way I made it work is by adding a bunch of  .

Any ideas?

Rick
LVL 2
boricua1213Asked:
Who is Participating?
 
VoteyDiscipleConnect With a Mentor Commented:
Ahhh, I see what's going on, sure.

I've just tried this out and it works ok:

text text text
<span width="3em"></span> <!-- a span the width of your link text -->
<span style="float: right; margin-top: -1em;">link</span>


This explicitly moves the link up one line, but to make sure it won't end up overlapping other text at the end of the line there's explicitly a chunk of empty space at the end of the line.
0
 
VoteyDiscipleCommented:
Try...

text text text text text
text text text <div style="float: right;">link</div>
0
 
boricua1213Author Commented:
That does not keep the link on the same line as the last line of the text.  It makes a new line.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
VoteyDiscipleCommented:
Ah, right, sorry:
<span style="float: right;">link</div>
0
 
boricua1213Author Commented:
Nope same thing
0
 
boricua1213Author Commented:
OK that worked had to play around with the margin-top value to get it to lineup with the rest of the text.  Otherwise it did the job.

Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.