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

标签 html css html-table

我得到了一个 html 表格,基本上看起来像这样 ( http://jsfiddle.net/LMaQq/ ):

<table>
    <thead>
        <tr>
            <th>Col 1</th>
            <th>Col 2</th>
            <th>Col 3</th>
            <th>Col 4</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Content</td>
            <td>Content</td>
            <td>Content</td>
            <td><input type="checkbox"></td>
        </tr>
        <tr>
            <td>Content</td>
            <td>Content</td>
            <td>Content</td>
            <td><input type="checkbox"></td>
        </tr>
    </tbody>
</table>

我现在要做的是仅在Col 4 下添加一个新的表格单元格。在 Col 1Col 3 下应该没有任何东西。所以它应该是这样的:

enter image description here

这样做的背景是,我想要在现有复选框下方添加一个复选框,这样我就可以同时选择/取消选择所有这些复选框。我怎样才能做到这一点?

最佳答案

检查这个 jsfiddle http://jsfiddle.net/LMaQq/7/

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;
}

希望这能满足您的要求。

关于底部有单个单元格的 HTML 表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18741601/

相关文章:

javascript - 用文本框输入替换 php 变量

html - CSS 内容 :url is not working in internet explorer 11

html - 使用html/css/javascript在菜单li中添加两个背景

html - 为什么表格的列这么宽?

html - 表格为行应用CSS

jquery - 识别表中的所有选择选项

javascript - 从现有 html 自动生成 html 源文档

css - 防止预加载图像?

css - Vue2导入css文件

html - 分页符不起作用