html - 良好的表格实践 - 在表格中制作标题的最佳方式?

标签 html header html-table spacing

我基本上有一个数据表,我想设置间距,这样它就不会挤在一起。但是我希望表格的标题栏(第一行)忽略单元格填充规则。

有什么好的方法吗?或者我是否必须为标题创建一个单独的表或其他内容?

最佳答案

是的,在你的 CSS 中:

table thead th { padding: 0; }
table tbody td { padding: 15px; }

假设:

<table>
<thead>
<tr>
  <th colspan="4">Big Heading</th>
</tr>
</thead>
<tbody>
<tr>
  <td>1</td>
  <td>2</td>
  <td>3</td>
  <td>4</td>
</tr>
</tbody>
</table>

关于html - 良好的表格实践 - 在表格中制作标题的最佳方式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1404479/

相关文章:

html - 变换:旋转模糊图像

html - 使用图像转换导航栏

HTML 表格延伸出屏幕

javascript - 下划线代码在网页上不显示任何内容

php - 从代码库中删除无用文件

html - 媒体查询不适用于某些触发器

http - 没有 Accept header 的 AWS API Gateway 二进制输出

http - 如何删除 Mule 默认 header 并设置从第三方 API 收到的 header

javascript - 循环遍历我的表的特定列

css - 条件行样式 xsl 和避免重复代码