底部有单个单元格的HTML表格

底部有单个单元格的HTML表格,html,css,html-table,Html,Css,Html Table,我得到了一个html表,基本上如下所示(): 第1列 第2列 第3列 第4列 内容 内容 内容 内容 内容 内容 我现在要做的是只在第4列下添加一个新的表单元格。在第1列到第3列下,不应该有任何内容。所以它应该是这样的: 这样做的背景是,我希望在现有复选框下有另一个复选框,它允许我同时选择/取消选择所有复选框。我怎样才能做到这一点呢?为所有不想显示的字段添加一些类,然后在该类集中可见性:隐藏为所有不想显示的字段添加一些类,在该类集中可见性:隐藏如下 在您的表格中添加下面的HTML代码 &l

我得到了一个html表,基本上如下所示():


第1列
第2列
第3列
第4列
内容
内容
内容
内容
内容
内容
我现在要做的是只在第4列下添加一个新的表单元格。在第1列到第3列下,不应该有任何内容。所以它应该是这样的:


这样做的背景是,我希望在现有复选框下有另一个复选框,它允许我同时选择/取消选择所有复选框。我怎样才能做到这一点呢?

为所有不想显示的字段添加一些类,然后在该类集中
可见性:隐藏
为所有不想显示的字段添加一些类,在该类集中
可见性:隐藏如下

在您的表格中添加下面的HTML代码

<tr>
   <td class="four" colspan=3></td>
   <td class="five"><input type="checkbox"></td>
</tr>
这是

在您的表格中添加下面的HTML代码

<tr>
   <td class="four" colspan=3></td>
   <td class="five"><input type="checkbox"></td>
</tr>

在表格底部添加一个新行,包含2个单元格

将colspan=“3”添加到隐藏css类的第一个单元格,然后删除此单元格上的边框

像平常一样对待第二个电话

HTML:


在表格底部添加一个包含2个单元格的新行

将colspan=“3”添加到隐藏css类的第一个单元格,然后删除此单元格上的边框

像平常一样对待第二个电话

HTML:


.b{
边框:1px纯黑;
文本对齐:居中;
}
查看,我希望您的问题得到解决。


.b{
边框:1px纯黑;
文本对齐:居中;
}

查看,我希望您的问题得到解决。

我甚至会将其放在tfoot部分。 如果您想使用jQuery选中/取消选中tbody中的所有复选框,这将更容易

    <tfoot>
        <td colspan="3" />
        <td><input type="checkbox"></td>
    </tfoot>

我甚至会把它放在tfoot部分。 如果您想使用jQuery检查/取消选中TBBody中的所有复选框,将更容易

    <tfoot>
        <td colspan="3" />
        <td><input type="checkbox"></td>
    </tfoot>

检查此JSFIDLE

CSS

table {
    width: 100%;
    border-spacing: 0;
}

td, th {
    border-top: 1px solid black;
    border-right: 1px solid black;
    text-align: center;
}

tr td:first-child,
tr th:first-child {
    border-left: 1px solid black;
}

tr:last-child td {
    border-left: 0;
    border-right: 0;
}

tr:last-child td:nth-child(3) {
    border-right: 1px solid black;
}

tr:last-child td:last-child {
    border-right: 1px solid black;
    border-bottom: 1px solid black;
}
希望这符合您的要求。

检查此JSFIDLE

CSS

table {
    width: 100%;
    border-spacing: 0;
}

td, th {
    border-top: 1px solid black;
    border-right: 1px solid black;
    text-align: center;
}

tr td:first-child,
tr th:first-child {
    border-left: 1px solid black;
}

tr:last-child td {
    border-left: 0;
    border-right: 0;
}

tr:last-child td:nth-child(3) {
    border-right: 1px solid black;
}

tr:last-child td:last-child {
    border-right: 1px solid black;
    border-bottom: 1px solid black;
}

希望这符合您的要求。

属性“colspan”是您需要的属性“colspan”是您需要的属性这是完美的解决方案。谢谢这是一个完美的解决方案。谢谢
    <tfoot>
        <td colspan="3" />
        <td><input type="checkbox"></td>
    </tfoot>
table {
    width: 100%;
    border-spacing: 0;
}

td, th {
    border-top: 1px solid black;
    border-right: 1px solid black;
    text-align: center;
}

tr td:first-child,
tr th:first-child {
    border-left: 1px solid black;
}

tr:last-child td {
    border-left: 0;
    border-right: 0;
}

tr:last-child td:nth-child(3) {
    border-right: 1px solid black;
}

tr:last-child td:last-child {
    border-right: 1px solid black;
    border-bottom: 1px solid black;
}