Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Right align and left align text in same HTML table cell

Tags:

html

css

I have a cell in an HTML <table>. I would like part of the cell contents to be left justified and part to be right justified. Is this possible?

like image 261
Brian Avatar asked Jan 18 '10 22:01

Brian


People also ask

How do you align text in a table cell in HTML?

To place an item at the top or bottom of its cell, insert the "VALIGN=" attribute within the code for that cell. To vertically align an entire row (e.g., placing all data in that row at the tops of the cells), insert the "VALIGN=" attribute within the code for that row.

How do I align text on the same line in HTML?

The text-align-last property specifies how to align the last line of a text. Notice that the text-align-last property sets the alignment for all last lines within the selected element. So, if you have a <div> with three paragraphs in it, text-align-last will apply to the last line of EACH of the paragraphs.


1 Answers

If you want them on separate lines do what Balon said. If you want them on the same lines, do:

<td>   <div style="float:left;width:50%;">this is left</div>   <div style="float:right;width:50%;">this is right</div> </td> 
like image 51
Tor Valamo Avatar answered Sep 16 '22 20:09

Tor Valamo