Keeping text at center bottom in a cell of table
Asked Answered
F

3

21

I want to place text at center and at the bottom of the cell in table. How can I do this?

This is what I want:

enter image description here

Finite answered 27/4, 2011 at 15:50 Comment(1)
for future reference, when you make a demo image, maybe you can crop it down to the necessary space rather than using up so much white space.Mcallister
S
52

CSS:

td {vertical-align:bottom;text-align:center;}

example: http://jsfiddle.net/vKPG8/

Surrey answered 27/4, 2011 at 15:54 Comment(0)
R
3

valign="bottom" might work.

http://www.w3schools.com/tags/att_td_valign.asp

But I think that's deprecated.

So you should do it in CSS with:

<td style="vertical-align:bottom;">your text</td>
Record answered 27/4, 2011 at 15:54 Comment(1)
valign is depreciated and should not be used.Mcallister
C
2

table, th, td {
	  border: 1px solid black;
	  border-collapse: collapse;
}
td{
  vertical-align:bottom;
  text-align:center;
  }
<table>
  <tr>
    <td rowspan="3" width="100%">bottom and center</td>
   </tr>
   <tr>
    <td rowspan="1">TOTAL</td>
   </tr>
   <tr>
    <td rowspan="1">TOTAL</td>
   </tr>
</table>

					    	

use style vertical-align:bottom;text-align:center; these can be helpful for your table.

Cyprinid answered 14/2, 2020 at 15:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.