html 中的行跨度问题
rowspan issue in html
我正在为我的解决方案编写一份报告sheet。但是我在合并来自 table 的行时遇到了问题。我附上了图片和一些源代码。在此图像中,我想合并黄色标记的列并使其成为单一列。任何人都请帮助我。
.mytable {
border-collapse: collapse;
width: 100%;
background-color: white;
}
.mytable-head {
border: 1px solid black;
margin-bottom: 0;
padding-bottom: 0;
}
.mytable-head td {
border: 1px solid black;
padding-top: 1px;
}
.mytable-body {
border: 1px solid black;
border-top: 0;
margin-top: 0;
padding-top: 0;
margin-bottom: 0;
padding-bottom: 0;
}
.mytable-body td {
border: 1px solid black;
border-top: 0;
}
.mytable-footer {
border: 1px solid black;
border-top: 0;
margin-top: 0;
padding-top: 0;
}
.mytable-footer td {
border: 1px solid black;
border-top: 0;
}
<table class="mytable mytable-body">
<tr>
<td width="10%" colspan="4">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="4">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%" colspan="4">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="6">Null</td>
</tr>
<tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="6">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%" colspan="4">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
</table>
在这里,我可以使用 <Div>
标签进行设计。代码在这里:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:60%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:60%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:30%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
这是解决方案。
您可以在此处编辑jsFiddle
添加代码 (CSS):
tr>td:first-child{
background: #ffe500;
}
tr>td{
border: 1px solid #ffe500 !important;
}
.mytable {
border-collapse: collapse;
width: 100%;
background-color: white;
}
.mytable-head {
border: 1px solid black;
margin-bottom: 0;
padding-bottom: 0;
}
.mytable-head td {
border: 1px solid black;
padding-top: 1px;
}
.mytable-body {
border: 1px solid black;
border-top: 0;
margin-top: 0;
padding-top: 0;
margin-bottom: 0;
padding-bottom: 0;
}
.mytable-body td {
border: 1px solid black;
border-top: 0;
}
.mytable-footer {
border: 1px solid black;
border-top: 0;
margin-top: 0;
padding-top: 0;
}
.mytable-footer td {
border: 1px solid black;
border-top: 0;
}
tr>td:first-child{
background: #ffe500;
border: 1px solid #ffe500;
}
tr>td{
border: 1px solid #ffe500 !important;
}
<table class="mytable mytable-body">
<tr>
<td width="10%" colspan="4">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="4">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%" colspan="4">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="6">Null</td>
</tr>
<tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="6">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%" colspan="4">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
</table>
我正在为我的解决方案编写一份报告sheet。但是我在合并来自 table 的行时遇到了问题。我附上了图片和一些源代码。在此图像中,我想合并黄色标记的列并使其成为单一列。任何人都请帮助我。
.mytable {
border-collapse: collapse;
width: 100%;
background-color: white;
}
.mytable-head {
border: 1px solid black;
margin-bottom: 0;
padding-bottom: 0;
}
.mytable-head td {
border: 1px solid black;
padding-top: 1px;
}
.mytable-body {
border: 1px solid black;
border-top: 0;
margin-top: 0;
padding-top: 0;
margin-bottom: 0;
padding-bottom: 0;
}
.mytable-body td {
border: 1px solid black;
border-top: 0;
}
.mytable-footer {
border: 1px solid black;
border-top: 0;
margin-top: 0;
padding-top: 0;
}
.mytable-footer td {
border: 1px solid black;
border-top: 0;
}
<table class="mytable mytable-body">
<tr>
<td width="10%" colspan="4">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="4">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%" colspan="4">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="6">Null</td>
</tr>
<tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="6">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%" colspan="4">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
</table>
在这里,我可以使用 <Div>
标签进行设计。代码在这里:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:60%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:60%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:30%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
<div id="border" style="width:100%; height:30px;">
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:10%; height:30px; border:1px solid black; float:right;"></div>
<div style="width:40%; height:30px; border:1px solid black; float:right;"></div>
</div>
这是解决方案。
您可以在此处编辑jsFiddle
添加代码 (CSS):
tr>td:first-child{
background: #ffe500;
}
tr>td{
border: 1px solid #ffe500 !important;
}
.mytable {
border-collapse: collapse;
width: 100%;
background-color: white;
}
.mytable-head {
border: 1px solid black;
margin-bottom: 0;
padding-bottom: 0;
}
.mytable-head td {
border: 1px solid black;
padding-top: 1px;
}
.mytable-body {
border: 1px solid black;
border-top: 0;
margin-top: 0;
padding-top: 0;
margin-bottom: 0;
padding-bottom: 0;
}
.mytable-body td {
border: 1px solid black;
border-top: 0;
}
.mytable-footer {
border: 1px solid black;
border-top: 0;
margin-top: 0;
padding-top: 0;
}
.mytable-footer td {
border: 1px solid black;
border-top: 0;
}
tr>td:first-child{
background: #ffe500;
border: 1px solid #ffe500;
}
tr>td{
border: 1px solid #ffe500 !important;
}
<table class="mytable mytable-body">
<tr>
<td width="10%" colspan="4">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="4">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%" colspan="4">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="6">Null</td>
</tr>
<tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="6">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%" colspan="3">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%" colspan="4">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
<tr>
<td width="40%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
<td width="10%">Null</td>
</tr>
</table>