我想将表格行的高度调整为24px。我已经尝试将行高放在顶部CSS中并将其写入内联。
CSS:
tbody tr {
line-height: 24px;
height: 24px;
padding: 0;
}
tbody td {
line-height: 24px;
height: 24px;
padding: 0;
}
HTML:
<table>
<thead id='dontMove'>
<tr id='theRow'>
<th>Rank</th>
<th>Applicants</th>
<th># Enrolled</th>
</tr>
</thead>
<tbody style='font-size: 12px;'>
<tr style='height: 24px;'>
<td style='height: 20px;'>Contents</td>
</tr>
<!-- rest of table contents -->
</tbody>
</table>
但是,似乎没有任何东西可以使表格行调整高度。我在这里做错了什么?
答案 0 :(得分:0)
使用24
的cellpadding将表内容包装在这样的div中<table cellpadding="24">
<thead id='dontMove'>
<tr id='theRow'>
<th>Rank</th>
<th>Applicants</th>
<th># Enrolled</th>
</tr>
</thead>
<tbody style='font-size: 12px;'>
<tr style='height: 24px;'>
<td style='height: 20px;'>Contents</td>
</tr>
</tbody>
</table>
请参阅此示例以供参考:http://www.w3schools.com/tags/att_table_cellpadding.asp