您的当前位置: 首页 > 新闻中心

html如何让表格只显示横线

发布时间:2026-11-29 03:42:08 浏览:1 次

以下是表格一个简单的例子:

html如何让表格只显示横线

<!DOCTYPE html><html><head><style>table {  bordercollapse: collapse; /* 合并边框 */}th, td {  borderbottom: 1px solid black; /* 只有下边框 */ padding: 15px; /* 单元格内边距 */}</style></head><body><h2>小标题</h2><table> <tr> <th>单元表格</th> <th>单元表格</th> </tr> <tr> <td>数据</td> <td>数据</td> </tr></table></body></html>

在这(zhe)个例子中,我们使(shi)用(yong)了bordercollapse: collapse;来合并边框,只(zhi)显然后设置了(le)borderbottom: 1px solid black;来让每个(ge)单元格只有下边框,示横我(wo)们也设置了padding: 15px;来增加单元格内(nei)的何让空白区域。

html如何让表格只显示横线

表格

html如何让表格只显示横线

搜索