html - 如何在表格中添加一行?

标签 html css html-table

我有一个这样的表:

<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
</tr>

但在 Peter Griffin 和 Lois Griffin 之间,我想划一条线将他们分开,如下所示:

_____________________
[Firstname][Lastname]
---------------------
[   Peter ][Griffin]
--------------------- <---add a line here
[   Lois  ][Griffin]
---------------------

最佳答案

应该使用 CSS,像这样的东西应该可以工作:

td { border-bottom: solid 1px #CCCCCC; }

如果你想将行中的单词隔开一点,请添加填充:

td { padding-top:5px; padding-bottom:5px; }

关于html - 如何在表格中添加一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7226652/

相关文章:

javascript - 如何将按钮连接到垂直滑动时变化的文本?

css - 在 Flexdashboard 或 Shiny 中滚动查找 gt 表 block

html - Bootstrap : 1 col sidebar taking height of the content of the other cols

html - <span> 标签在 IE7 中断行

javascript - 如何增加Firefox上IndexedDB的配额?

html - Select 元素的增长与 display flex 中的 input 不同

javascript - 添加class到clicked th和对应的td

jquery - 在 jQuery 中将 HTML 表格数据转换为 JSON 对象

html - 在 ul 中使用绝对定位的子 div

html - 有色背景图像不适用于 Bootstrap