现在,我设置了侧边距、顶部和底部填充,但是虽然每个单元格都相同,但当一个单元格中有更多文本时,文本开始的高度会根据方式不同而不同有很多文字。我应该怎么做才能使文本从与单元格顶部的相同距离开始,而不管文本的数量如何,然后从那里向下推?所以我最终得到这样的东西:
相对于这样的东西:
当前代码:
.bottom-table td {
padding-left: 10px;
padding-right: 10px;
padding-top: 20px;
padding-bottom: 50px;
}
还有一些代码将整个表格设置为样式(不认为它是相关的,但在这里它是):
.bottom-table {
-moz-border-radius: 15px !important;
border-radius: 15px !important;
border: 2px solid black !important;
width: 75%;
text-align: center;
margin-right: auto;
margin-left: auto;
}
这是一个带有相关代码的 JSFiddle:http://jsfiddle.net/zLyNm/
最佳答案
将 vertical-align: top
添加到 .bottom-table td
。
.bottom-table td {
padding-left: 10px;
padding-right: 10px;
padding-top: 20px;
padding-bottom: 50px;
vertical-align: top;
}
关于html - 如何强制 HTML 表格中的文本从距单元格顶部一定距离开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25044273/