Html 将文本保持在表格单元格的中心底部

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5806913/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 08:16:44  来源:igfitidea点击:

Keeping text at center bottom in a cell of table

htmlcsscss-tables

提问by Suhail Gupta

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

在此处输入图片说明

回答by MikeM

CSS:

CSS:

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

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

示例:http: //jsfiddle.net/vKPG8/

回答by sym3tri

valign="bottom" might work.

valign="bottom" 可能会起作用。

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

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

But I think that's deprecated.

但我认为这已被弃用。

So you should do it in CSS with:

所以你应该在 CSS 中使用:

<td style="vertical-align:bottom;">your text</td>

回答by Prerita Verma

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.

使用样式垂直对齐:底部;文本对齐:中心;这些对您的餐桌很有帮助。