我想知道如何垂直对齐底部水平滚动的两个表。如何垂直对齐水平滚动底部的两个表
以下是HTML代码:
<div class="cntnr">
<div class="tabtwocntnr">
<table class="tabtwo">
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
<th>Header 5</th>
<th>Header 6</th>
<th>Header 7</th>
<th>Header 8</th>
<th>Header 9</th>
<th>Header 10</th>
<th>Header 11</th>
<th>Header 12</th>
<th>Header 13</th>
<th>Header 14</th>
<th>Header 15</th>
<th>Header 16</th>
<th>Header 17</th>
<th>Header 18</th>
<th>Header 19</th>
<th>Header 20</th>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
<th>Header 5</th>
<th>Header 6</th>
<th>Header 7</th>
<th>Header 8</th>
<th>Header 9</th>
<th>Header 10</th>
<th>Header 11</th>
<th>Header 12</th>
<th>Header 13</th>
<th>Header 14</th>
<th>Header 15</th>
<th>Header 16</th>
<th>Header 17</th>
<th>Header 18</th>
<th>Header 19</th>
<th>Header 20</th>
</tr>
</thead>
</table>
</div>
<div class="tabthreecntnr">
<table class="tabthree">
<tbody>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
<td>Content 4</td>
<td>Content 5</td>
<td>Content 6</td>
<td>Content 7</td>
<td>Content 8</td>
<td>Content 9</td>
<td>Content 10</td>
<td>Content 11</td>
<td>Content 12</td>
<td>Content 13</td>
<td>Content 14</td>
<td>Content 15</td>
<td>Content 16</td>
<td>Content 17</td>
<td>Content 18</td>
<td>Content 19</td>
<td>Content 20</td>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
<td>Content 4</td>
<td>Content 5</td>
<td>Content 6</td>
<td>Content 7</td>
<td>Content 8</td>
<td>Content 9</td>
<td>Content 10</td>
<td>Content 11</td>
<td>Content 12</td>
<td>Content 13</td>
<td>Content 14</td>
<td>Content 15</td>
<td>Content 16</td>
<td>Content 17</td>
<td>Content 18</td>
<td>Content 19</td>
<td>Content 20</td>
</tr>
</tbody>
</table>
</div>
</div>
相应的CSS是:
.tabtwo,.tabthree{
border-collapse: collapse;
table-layout:fixed;
}
.tabtwo th, .tabthree td{
border-right: 1px solid black;
}
.tabthree td{
text-align: center;
border-top: 1px solid #000;
}
.tabtwocntnr,.tabthreecntnr{
width:100%;
}
.cntnr{
overflow-x:auto;
width: 100%;
border: 1px solid black;
}
的小提琴是: http://jsfiddle.net/8H5Ek/
正如我们在这个小提琴看到两个表没有正确对齐(相对于彼此)。在底部桌子的右角也有一些空白。我试图通过应用table-layout来解决它:fixed;到两个表。
我无法达到预期的效果。
请帮助我通过贡献。
为什么他们分成两个表 - 他们应该是,如果在同一个表的一部分数据是表格,否则你不应该使用表格,因为它会让你感觉到没有任何相应的tds - http://jsfiddle.net/peteng/8H5Ek/5/ – Pete
我的要求迫使我把它们分成两个表格 – user2594152
然后你正在写坏web内容 – Pete