Skip to content

Commit 9376a7c

Browse files
committed
Fixes twbs#5729: Nested striped tables
* Scopes striping to immediate children of the tbody and tr * For nested tables, sets a background color of @bodyBackground, to override the default transparent bg
1 parent cacc213 commit 9376a7c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

docs/assets/css/bootstrap.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,6 +2012,10 @@ table {
20122012
border-top: 2px solid #dddddd;
20132013
}
20142014

2015+
.table .table {
2016+
background-color: #ffffff;
2017+
}
2018+
20152019
.table-condensed th,
20162020
.table-condensed td {
20172021
padding: 4px 5px;
@@ -2104,8 +2108,8 @@ table {
21042108
-moz-border-radius-topright: 4px;
21052109
}
21062110

2107-
.table-striped tbody tr:nth-child(odd) td,
2108-
.table-striped tbody tr:nth-child(odd) th {
2111+
.table-striped tbody > tr:nth-child(odd) > td,
2112+
.table-striped tbody > tr:nth-child(odd) > th {
21092113
background-color: #f9f9f9;
21102114
}
21112115

less/tables.less

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ table {
4848
tbody + tbody {
4949
border-top: 2px solid @tableBorder;
5050
}
51+
52+
// Nesting
53+
.table {
54+
background-color: @bodyBackground;
55+
}
5156
}
5257

5358

@@ -143,8 +148,8 @@ table {
143148
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
144149
.table-striped {
145150
tbody {
146-
tr:nth-child(odd) td,
147-
tr:nth-child(odd) th {
151+
> tr:nth-child(odd) > td,
152+
> tr:nth-child(odd) > th {
148153
background-color: @tableBackgroundAccent;
149154
}
150155
}

0 commit comments

Comments
 (0)