TIMEX
TIMEX

Reputation: 272174

How do I apply a border radius to Bootstrap 3's tables?

I want the top corners and bottom corners of a table to have rounded corners.

How can I do this? Right now, the Bootstrap 3 tables have 0 radius.

Upvotes: 8

Views: 16684

Answers (2)

Iman Sedighi
Iman Sedighi

Reputation: 8192

The easiest way is wrap the table with a panel. Then your table will have rounded corners automatically.

Example:

<div class="panel panel-default">
   <table class="table table-striped">
      ....
   </table>
</div>

Note: panel-default will add a 1px grey border. if you want to hide it just add border-color:white; to style of panel-default.

Upvotes: 11

Anup
Anup

Reputation: 9748

Try this :-

<table class="table table-curved">
    ....
</table>    

.table-curved {
    border-collapse: separate;
}
.table-curved {
    border: solid #ccc 1px;
    border-radius: 6px;
    border-left:0px;
}
.table-curved td, .table-curved th {
    border-left: 1px solid #ccc;
    border-top: 1px solid #ccc;
}
.table-curved th {
    border-top: none;
}
.table-curved th:first-child {
    border-radius: 6px 0 0 0;
}
.table-curved th:last-child {
    border-radius: 0 6px 0 0;
}
.table-curved th:only-child{
    border-radius: 6px 6px 0 0;
}
.table-curved tr:last-child td:first-child {
    border-radius: 0 0 0 6px;
}
.table-curved tr:last-child td:last-child {
    border-radius: 0 0 6px 0;
}

Upvotes: 12

Related Questions