Danilo Kobold
Danilo Kobold

Reputation: 2581

tr not displaying border-bottom

I'm trying to create a datagrid and stumbled on two problems.

I had to use border-collapse: separate; to get round corners on top. But by doing that I lost the ability to add borders on tr botton.

Any insights?

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>

Upvotes: 2

Views: 10292

Answers (3)

w3jimmy
w3jimmy

Reputation: 712

this works:

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

Upvotes: 0

Matthew Green
Matthew Green

Reputation: 10391

You can put the bottom-border on table.dgrid th, table.dgrid td and then I would update the table.dgrid tbody tr:last-child to have the td in there like so: table.dgrid tbody tr:last-child td.

Upvotes: 2

Seimen
Seimen

Reputation: 7250

Remove border-collapse: separate; from table.dgrid.

Upvotes: 1

Related Questions