Datatables 1.10 + Bootstrap丢失了蓝白条纹行模式

时间:2015-04-14 13:47:27

标签: django twitter-bootstrap datatables

我正在使用Bootstrap 3 + Datatables 1.09,一切都很好。我试图升级到Datatables 1.10,我的表格的蓝白条纹图案不再出现了。如果我将“table table-striped”类添加到我的表中,则条纹图案为灰白色。如何恢复原始的蓝色条纹图案? 问候, 帕特里克

1 个答案:

答案 0 :(得分:1)

DataTables网站上的

Bootstrap 3 example确实显示了一个灰色/白色图案的表格,此样式在Bootstrap CSS文件中定义。在没有查看CSS文件及其顺序的情况下,升级后丢失的样式很难说。

要覆盖此模式,请在结束</head>标记之前添加以下代码,并将table-striped类添加到您的表中。

<style type="text/css">
/* BOOTSTRAP 3 TWEAKS */
.table-striped > tbody > tr:nth-of-type(2n+1),
.table-striped > tbody > tr.odd {
    background-color: #D9EDF7;
}
.table-striped > tbody > tr.even {
    background-color: #FFF;
}
</style>

更新:更新了CSS以对偶数行进行着色。