Skip to content

Commit

Permalink
Fixes #5729: Nested striped tables
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mdo committed Dec 8, 2012
1 parent cacc213 commit 9376a7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions docs/assets/css/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,10 @@ table {
border-top: 2px solid #dddddd;
}

.table .table {
background-color: #ffffff;
}

.table-condensed th,
.table-condensed td {
padding: 4px 5px;
Expand Down Expand Up @@ -2104,8 +2108,8 @@ table {
-moz-border-radius-topright: 4px;
}

.table-striped tbody tr:nth-child(odd) td,
.table-striped tbody tr:nth-child(odd) th {
.table-striped tbody > tr:nth-child(odd) > td,
.table-striped tbody > tr:nth-child(odd) > th {
background-color: #f9f9f9;
}

Expand Down
9 changes: 7 additions & 2 deletions less/tables.less
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ table {
tbody + tbody {
border-top: 2px solid @tableBorder;
}

// Nesting
.table {
background-color: @bodyBackground;
}
}


Expand Down Expand Up @@ -143,8 +148,8 @@ table {
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.table-striped {
tbody {
tr:nth-child(odd) td,
tr:nth-child(odd) th {
> tr:nth-child(odd) > td,
> tr:nth-child(odd) > th {
background-color: @tableBackgroundAccent;
}
}
Expand Down

0 comments on commit 9376a7c

Please sign in to comment.