Jump to content

Right align the last words in a paragraph to the bottom right of a table cell


pengi
 Share

Recommended Posts

Hello everybody,

 

I have created a table with fixed cell width and height for each cell. Now I would like to put some text, which end with a number into the cells. I assume the height is good enough for a paragraph of 2 lines only, but the number should always be aligned right at the bottom line. I have tried this CSS:

 

.para      { display:block; margin-left:0px; margin-right:0px;}
.para span { display:block; margin-left:0px; margin-right:0px; float:right; text-align:right;}

 

With this HTML:

<td height='40'><p class="para">Here is the description. <span>135</span></p></td>

 

It works ok, but if the words and the number only spans one single line, the number will be right-aligned at Line 1 instead.

On the other hand, if I change float:right to float:bottom-right, when the words spans 2 lines, the number will be dropped to the right side of Line 3. Is there any way to solve the problem so that the number is always shown on Line 2 and right-aligned?

 

Thanks!

Pengi.

 

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.