Right justify last line of text?

Posted on 2006-11-13
Last Modified: 2006-11-18

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?

Question by:boricua1213
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 19

Expert Comment

ID: 17934848

text text text text text
text text text <div style="float: right;">link</div>

Author Comment

ID: 17934865
That does not keep the link on the same line as the last line of the text.  It makes a new line.
LVL 19

Expert Comment

ID: 17934889
Ah, right, sorry:
<span style="float: right;">link</div>
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 17934904
Nope same thing
LVL 19

Accepted Solution

VoteyDisciple earned 500 total points
ID: 17934962
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.

Author Comment

ID: 17935080
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.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question