table {
border-spacing:0 10px;
border-collapse:separate;
}
td {
padding:2px 10px;
border-top:1px solid #ddd;
border-bottom:1px solid #ddd;
}
td.gray {
background:#ddd
}
td:last-child {
border-right:1px solid #ddd;
}
<table>
<tr>
<td class="gray"> Module description </td>
</tr>
<tr rowspan = "2">
<td> This module aims to provide a comprehensive knowledge and experience of the relational database model and
its effective design, administration and implementation in order to to support data driven applications.</td>
</table>
下面是我希望我的桌子看起来像什么以及我现在拥有什么的图像。我不能让表行合并并摆脱第一行和第二行之间的划分。
这就是我想要的表格:
这是我到目前为止所做的:
答案 0 :(得分:1)
设置填充并删除边框间距可以解决问题:
table {
border: 1px solid #ddd;
padding: 0;
border-collapse: collapse;
}
td {
padding: 2px 10px;
}
td.gray {
background:#ddd
}
<table>
<tr>
<td class="gray"> Module description </td>
</tr>
<tr>
<td> This module aims to provide a comprehensive knowledge and experience of the relational database model and
its effective design, administration and implementation in order to to support data driven applications.</td>
</table>
一点背景:使用border-collapse
(请参阅docs),您可以定义单元格边框是否是单独的(如您的问题中)或折叠。 Rowspan
仅适用于跨越多行(tr)垂直扩展单元格,因此此处不执行任何操作。
答案 1 :(得分:1)
当您有多列并希望合并其中一列的行时,您可以使用rowspan。由于您上面只有一列,因此您无法在此处使用此列。
我在下面修改了几个css。
table {
border-collapse:separate;
border:1px solid #ddd;
padding: 0;
}
td {
padding:2px 10px;
}
td.gray {
background:#ddd
}
td:last-child {
border-top:0 solid #ddd;
}
&#13;
<table cellpadding="0" cellspacing="0">
<tr>
<td class="gray"> Module description </td>
</tr>
<tr>
<td> This module aims to provide a comprehensive knowledge and experience of the relational database model and
its effective design, administration and implementation in order to to support data driven applications.</td>
</table>
&#13;
答案 2 :(得分:1)
我会这样做:
table {
border-spacing:0 10px;
border-collapse:collapse;
}
td {
padding:2px 10px;
border:1px solid #ddd;
}
td.gray {
background-color: gray;
}
<table>
<tr>
<td class="gray"> Module description </td>
</tr>
<tr>
<td>This module aims to provide a comprehensive knowledge and experience of the relational database model and
its effective design, administration and implementation in order to to support data driven applications.Bla Bla Bla</td>
</tr>
</table>
你的html语法中有一些错误。