2

我正在尝试创建一个数据网格并偶然发现了两个问题。

我不得不使用border-collapse:分开;在顶部获得圆角。但是这样做我失去了在 tr 按钮上添加边框的能力。

有什么见解吗?

http://fiddle.jshell.net/KNb7K/

CSS:

table.dgrid {
    border: solid 1px #CDCDCD;
    .border-radius(8px, 0px, 0px, 8px);
    width: 100%;
    border-collapse: separate;
}
table.dgrid th:first-child{
    .border-radius(0px, 0px, 0px, 8px);
}

table.dgrid th:last-child{
    .border-radius(8px, 0px, 0px, 0px);
}

table.dgrid th{
    background-color: #E6E6E6;
}
table.dgrid tr th:last-child, table.dgrid tr td:last-child{
    border-right: 0px; 
}
table.dgrid tbody tr:last-child {
    border-bottom: 0;
}
table.dgrid tr {
    border-bottom: solid 1px #CDCDCD;
    border-collapse: collapse ;   
}
table.dgrid th, table.dgrid td {
    padding: 5px;
    text-align: center;
    vertical-align: middle;
    border-right: solid 1px #CDCDCD;
}

html:

<table class="dgrid">
    <thead>
        <tr>
            <th>Ativar</th>
            <th>Imagem</th>
            <th>Posição</th>
            <th>Link</th>
            <th>Excluir</th>
        </tr>
    </thead>   
    <tbody>
        <tr>
            <td><input type="checkbox" /></td>
            <td></td>
            <td></td>
            <td><input type="text" /></td>
            <td></td>
        </tr>
                <tr>
            <td><input type="checkbox" /></td>
            <td></td>
            <td></td>
            <td><input type="text" /></td>
            <td></td>
        </tr>
                <tr>
            <td><input type="checkbox" /></td>
            <td></td>
            <td></td>
            <td><input type="text" /></td>
            <td></td>
        </tr>
    </tbody>
</table>
4

3 回答 3

2

你可以把它bottom-border放在上面table.dgrid th, table.dgrid td,然后我会更新它table.dgrid tbody tr:last-childtd让它像这样:table.dgrid tbody tr:last-child td.

于 2013-02-07T15:05:43.333 回答
1

border-collapse: separate;从中删除table.dgrid

于 2013-02-07T15:02:19.303 回答
0

这有效:

table.dgrid {
    width: 98%;
    border-collapse: separate;
    border-bottom: solid 1px #CDCDCD;
    margin:1%;
}
table.dgrid th:first-child{
    border-top-left-radius: 8px;
}
table.dgrid th:first-child, table.dgrid td:first-child{
    border-left: solid 1px #CDCDCD;
}
table.dgrid th:last-child{
    border-top-right-radius: 8px;
}
table.dgrid th{
    background-color: #E6E6E6;
}
table.dgrid tbody tr:last-child {
    border-bottom: 0;
}
table.dgrid th, table.dgrid td {
    padding: 5px;
    text-align: center;
    vertical-align: middle;
    border-top: solid 1px #CDCDCD;
    border-right: solid 1px #CDCDCD;
}
于 2013-02-07T15:29:30.807 回答