html - 如何在表格单元格上添加边框,而不是在 html 上的整个表格?

标签 html css html-table

我正在尝试在表格单元格上添加边框,但我不知道如何使用 rowspan 来完成。

我想要一个有 4 个单元格的表格 大格子左边1个大格子,大格子右边3个小格子。

这是我使用的代码

jsfiddle[点]net/1fv4dz5g/3/

最佳答案

这可以使用 CSS 来完成。检查这个 css 示例

td {
  border: 1px solid black;
}
<table class="tnews-side" border="0">

<tr>
<td rowspan="3">
<table border="1" cellpadding="4" cellspacing ="0">Row 1 Cell 1</table>
</td>
  <td>Row 1 Cell 2</td>
</tr>
<tr>
  <td>Row 2 Cell 2</td>
</tr>
<tr>
  <td>Row 2 Cell 2</td>
</tr>
</table>

关于html - 如何在表格单元格上添加边框,而不是在 html 上的整个表格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39969274/

相关文章:

html5,段落内的图形/无花果标题给出了不可预测的输出

html - 动态表中的固定宽度列

css - Firefox 中的链接文本颜色错误

html - z-index 在选项卡下无法自动完成

javascript - Html 表格行对齐

javascript - D3 条形图。如何根据JSON数据设置自定义x轴和y轴?

javascript - 在 jquery Mobile 中获取表单 ID 'pageshow'

html - 如何在 flex 容器中的居中 div 之间创建相等的间距

arrays - 使用数组使用 VBA for Excel 获取 HTML 表格内容

html - 如何制作一个固定宽度但不固定高度的表格?