Table 元素未拉伸到 100%

Table element isn't stretching across 100%

我一直试图让一个元素延伸到 table 的整个长度,问题是某个 space 总是留在这个元素的最边缘。

所以我一直在尝试将处理 'recent posts' 的元素一直延伸到边缘,并且我已经弄乱它​​几个小时试图更改显示并更改它的方式格式化。

注意:由于相关网站上的混乱,我花时间将所有问题和解决方案打包到一个 JSFiddle 中......这应该会让任何人都更容易理解解决方案。

JSFiddle:https://jsfiddle.net/zm7bpr8p/2/

<table width="1000" border="1">
<thead>
<tr>
<th>Test1</th>
<th>Test2</th>
<th>HEAD1</th>
<th>HEAD2</th>
<th>Comments</th>
</tr>
</thead>
<tr>
<td>Test1</td>
<td>Test2</td>
<td class="DR1">DISABLED</td>
<td class="DR2">DISABLED2</td>
<td>Comments</td>
</tr>
</table>

您的 table 的列有问题。

您的第一行有 5 个单元格,但其他行只有 3 个(“.threads”和“.posts”不可见)。

将这两个单元格也隐藏在您的 th 中,问题已解决。

变换:

td.threads, td.posts {
    display: none;
    padding: 0px !important;
}

收件人:

td.threads, td.posts, th.threads, th.posts {
    display: none;
    padding: 0px !important;
}

在您的 table 的 "thread" 中,仍有五列 "threads" 和 "posts" 仍然可见。似乎您错过了添加此 CSS 样式。

/*Add this CSS style*/

.list >thead .threads, .list >thead .posts {
   display: none;
}

或者您可以隐藏所有 "threads" 和 "posts" 列。

/*Add this CSS style*/
.list .threads, .list .posts {
   display: none;
}

希望对您有所帮助 ;)