Twitter Bootstrap 3中的圆形表格

Phi*_*ana 54 html-table rounded-corners css3 twitter-bootstrap-3

Bootstrap 3在桌子上掉落圆角.在申请.table-bordered课程时,我应该申请哪些样式才能让他们回来,好吗?

UPDATE

到目前为止,我已经来到这个代码,没有任何效果.

从Bootstrap 2.3.2中获取的CSS:

.table-bordered
{
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
}

.table-bordered thead:first-child tr:first-child > th:first-child, .table-bordered tbody:first-child tr:first-child > td:first-child, .table-bordered tbody:first-child tr:first-child > th:first-child
{
    -webkit-border-top-left-radius: 4px;
    border-top-left-radius: 4px;
    -moz-border-radius-topleft: 4px;
}

.table-bordered thead:last-child tr:last-child > th:first-child, .table-bordered tbody:last-child tr:last-child > td:first-child, .table-bordered tbody:last-child tr:last-child > th:first-child, .table-bordered tfoot:last-child tr:last-child > td:first-child, .table-bordered tfoot:last-child tr:last-child > th:first-child
{
    -webkit-border-bottom-left-radius: 4px;
    border-bottom-left-radius: 4px;
    -moz-border-radius-bottomleft: 4px;
}
Run Code Online (Sandbox Code Playgroud)

HTML代码:

<table class="table table-hover table-responsive table-bordered">
    <thead>
        <tr>
            <th style="width: 50%">
                Config. Name
            </th>
            <th>
                API Calls
            </th>
            <th>
                Current Amount
            </th>
            <th>
                Actions
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                <a href="/searchsources/details">Agennda</a>
            </td>
            <td>
                2,876
            </td>
            <td>
                $ 80.67
            </td>
            <td>
                <a href="/searchsources/details">Edit</a>
            </td>
        </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

小智 147

如果你用一个面板环绕桌子,你会得到圆角.

像这样:

<div class="panel panel-default">
    <table class="table table-bordered">
        ....
    </table>
</div>
Run Code Online (Sandbox Code Playgroud)

  • 我必须删除第一行的单元格顶部边框,但是效果很好。谢谢! (2认同)
  • 这是真正的答案. (2认同)
  • 面板现在是引导程序4中的卡片。因此,只需将&lt;div class =“ panel panel-default”&gt;替换为&lt;div class =“ card”&gt;。同样,创建另一个嵌套的div围绕表作为卡片主体将使其看起来更整洁。&lt;div class =“ card-body”&gt;` (2认同)

Chr*_*ina 28

"table-responsive"在包装表的div上进行,而不是在表本身上.

在normalize.less中,表重置包括border-collapse:collapse.这不是Bootstrap的2.x. 由于这种新的重置,没有圆角,因为那些必须是边界崩溃:分开.您必须创建一个单独的类并相应地进行设置.

       <table class="table table-curved">
Run Code Online (Sandbox Code Playgroud)

仅适用于"table-hover"和"table-striped"NOT table-bordered.边框包含在此样式中.

.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;
}
Run Code Online (Sandbox Code Playgroud)

  //  Added Rounded Corner Tables 
.table-curved {
  border-collapse: separate;
  border: solid @table-border-color 1px;
  border-radius: @table-radius;
  border-left:0px;

    td, th {
      border-left: 1px solid @table-border-color;
      border-top: 1px solid @table-border-color;
    }

    th {
      border-top: none;
    }

    th:first-child {
      border-radius: @table-radius 0 0 0;
    }

    th:last-child {
      border-radius: 0 @table-radius 0 0;
    }

    th:only-child{
      border-radius: @table-radius @table-radius 0 0;
    }

    tr:last-child td:first-child {
      border-radius: 0 0 0 @table-radius;
    }

    tr:last-child td:last-child {
      border-radius: 0 0 @table-radius 0;
    }
}
Run Code Online (Sandbox Code Playgroud)


Ale*_*lak 10

使用Christina的答案和这个帖子,我想出了这个CSS来获得有或没有THEAD的表中的圆角.

.table-curved {
   border-collapse: separate;
   border: solid #ccc 1px;
   border-radius: 6px;
   border-left: 0px;
   border-top: 0px;
}
.table-curved > thead:first-child > tr:first-child > th {
    border-bottom: 0px;
    border-top: solid #ccc 1px;
}
.table-curved td, .table-curved th {
    border-left: 1px solid #ccc;
    border-top: 1px solid #ccc;
}
.table-curved > :first-child > :first-child > :first-child {
    border-radius: 6px 0 0 0;
}
.table-curved > :first-child > :first-child > :last-child {
    border-radius: 0 6px 0 0;
}
.table-curved > :last-child > :last-child > :first-child {
    border-radius: 0 0 0 6px;
}
.table-curved > :last-child > :last-child > :last-child {
    border-radius: 0 0 6px 0;
}
Run Code Online (Sandbox Code Playgroud)