rewrite all table styles to remove in selectors

This commit is contained in:
Mark Otto 2014-12-18 22:59:47 -08:00
parent 83b3252404
commit 547f16b58e
8 changed files with 108 additions and 238 deletions

View File

@ -1722,39 +1722,42 @@ th {
max-width: 100%;
margin-bottom: 1rem;
}
.table > thead > tr > th, .table > thead > tr > td, .table > tbody > tr > th, .table > tbody > tr > td, .table > tfoot > tr > th, .table > tfoot > tr > td {
.table th, .table td {
padding: .75rem;
line-height: 1.5;
vertical-align: top;
border-top: 1px solid #eceeef;
}
.table > thead > tr > th {
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #eceeef;
}
.table > tbody + tbody {
.table tbody + tbody {
border-top: 2px solid #eceeef;
}
.table .table {
background-color: #fff;
}
.table-sm > thead > tr > th, .table-sm > thead > tr > td, .table-sm > tbody > tr > th, .table-sm > tbody > tr > td, .table-sm > tfoot > tr > th, .table-sm > tfoot > tr > td {
.table-sm th, .table-sm td {
padding: .3rem;
}
.table-bordered {
border: 1px solid #eceeef;
}
.table-bordered > thead > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > th, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > th, .table-bordered > tfoot > tr > td {
.table-bordered th, .table-bordered td {
border: 1px solid #eceeef;
}
.table-bordered > thead > tr > th, .table-bordered > thead > tr > td {
.table-bordered thead th, .table-bordered thead td {
border-bottom-width: 2px;
}
.table-striped > tbody > tr:nth-child(odd) {
.table-striped tbody tr:nth-child(odd) {
background-color: #f9f9f9;
}
.table-hover > tbody > tr:hover {
.table-hover tbody tr:hover {
background-color: #f5f5f5;
}
@ -1811,43 +1814,17 @@ table td[class*="col-"], table th[class*="col-"] {
}
.table-responsive {
min-height: .01%;
display: block;
width: 100%;
overflow-x: auto;
}
@media screen and (max-width: 33.9em) {
.table-responsive {
width: 100%;
margin-bottom: 1rem;
overflow-y: hidden;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #eceeef;
}
.table-responsive > .table {
margin-bottom: 0;
}
.table-responsive > .table > thead > tr > th, .table-responsive > .table > thead > tr > td, .table-responsive > .table > tbody > tr > th, .table-responsive > .table > tbody > tr > td, .table-responsive > .table > tfoot > tr > th, .table-responsive > .table > tfoot > tr > td {
white-space: nowrap;
}
.table-responsive > .table-bordered {
border: 0;
}
.table-responsive > .table-bordered > thead > tr > th:first-child, .table-responsive > .table-bordered > thead > tr > td:first-child, .table-responsive > .table-bordered > tbody > tr > th:first-child, .table-responsive > .table-bordered > tbody > tr > td:first-child, .table-responsive > .table-bordered > tfoot > tr > th:first-child, .table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0;
}
.table-responsive > .table-bordered > thead > tr > th:last-child, .table-responsive > .table-bordered > thead > tr > td:last-child, .table-responsive > .table-bordered > tbody > tr > th:last-child, .table-responsive > .table-bordered > tbody > tr > td:last-child, .table-responsive > .table-bordered > tfoot > tr > th:last-child, .table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0;
}
.table-responsive > .table-bordered > tbody > tr:last-child > th, .table-responsive > .table-bordered > tbody > tr:last-child > td, .table-responsive > .table-bordered > tfoot > tr:last-child > th, .table-responsive > .table-bordered > tfoot > tr:last-child > td {
border-bottom: 0;
}
}
.table > .thead-inverse > tr > th {
.thead-inverse th {
color: #fff;
background-color: #373a3c;
}
.table > .thead-default > tr > th {
.thead-default th {
color: #55595c;
background-color: #eceeef;
}
@ -1859,7 +1836,7 @@ table td[class*="col-"], table th[class*="col-"] {
.table-inverse.table-bordered {
border: 0;
}
.table-inverse > thead > tr > th, .table-inverse > thead > tr > td, .table-inverse > tbody > tr > th, .table-inverse > tbody > tr > td {
.table-inverse th, .table-inverse td {
border-color: #55595c;
}
@ -1870,14 +1847,14 @@ table td[class*="col-"], table th[class*="col-"] {
display: block;
white-space: nowrap;
}
.table-reflow > thead > tr > th, .table-reflow > thead > tr > td, .table-reflow > tbody > tr > th, .table-reflow > tbody > tr > td, .table-reflow > tfoot > tr > th, .table-reflow > tfoot > tr > td {
.table-reflow th, .table-reflow td {
border-top: 1px solid #eceeef;
border-left: 1px solid #eceeef;
}
.table-reflow > thead > tr > th:last-child, .table-reflow > thead > tr > td:last-child, .table-reflow > tbody > tr > th:last-child, .table-reflow > tbody > tr > td:last-child, .table-reflow > tfoot > tr > th:last-child, .table-reflow > tfoot > tr > td:last-child {
.table-reflow th:last-child, .table-reflow td:last-child {
border-right: 1px solid #eceeef;
}
.table-reflow > thead:last-child > tr:last-child > th, .table-reflow > thead:last-child > tr:last-child > td, .table-reflow > tbody:last-child > tr:last-child > th, .table-reflow > tbody:last-child > tr:last-child > td, .table-reflow > tfoot:last-child > tr:last-child > th, .table-reflow > tfoot:last-child > tr:last-child > td {
.table-reflow thead:last-child tr:last-child th, .table-reflow thead:last-child tr:last-child td, .table-reflow tbody:last-child tr:last-child th, .table-reflow tbody:last-child tr:last-child td, .table-reflow tfoot:last-child tr:last-child th, .table-reflow tfoot:last-child tr:last-child td {
border-bottom: 1px solid #eceeef;
}
.table-reflow tr {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -193,13 +193,13 @@ Add `.table-bordered` for borders on all sides of the table and cells.
</thead>
<tbody>
<tr>
<th scope="row">1</tg>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</tg>
<th scope="row">2</th>
<td>Mark</td>
<td>Otto</td>
<td>@TwBootstrap</td>

View File

@ -1722,39 +1722,42 @@ th {
max-width: 100%;
margin-bottom: 1rem;
}
.table > thead > tr > th, .table > thead > tr > td, .table > tbody > tr > th, .table > tbody > tr > td, .table > tfoot > tr > th, .table > tfoot > tr > td {
.table th, .table td {
padding: .75rem;
line-height: 1.5;
vertical-align: top;
border-top: 1px solid #eceeef;
}
.table > thead > tr > th {
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #eceeef;
}
.table > tbody + tbody {
.table tbody + tbody {
border-top: 2px solid #eceeef;
}
.table .table {
background-color: #fff;
}
.table-sm > thead > tr > th, .table-sm > thead > tr > td, .table-sm > tbody > tr > th, .table-sm > tbody > tr > td, .table-sm > tfoot > tr > th, .table-sm > tfoot > tr > td {
.table-sm th, .table-sm td {
padding: .3rem;
}
.table-bordered {
border: 1px solid #eceeef;
}
.table-bordered > thead > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > th, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > th, .table-bordered > tfoot > tr > td {
.table-bordered th, .table-bordered td {
border: 1px solid #eceeef;
}
.table-bordered > thead > tr > th, .table-bordered > thead > tr > td {
.table-bordered thead th, .table-bordered thead td {
border-bottom-width: 2px;
}
.table-striped > tbody > tr:nth-child(odd) {
.table-striped tbody tr:nth-child(odd) {
background-color: #f9f9f9;
}
.table-hover > tbody > tr:hover {
.table-hover tbody tr:hover {
background-color: #f5f5f5;
}
@ -1811,43 +1814,17 @@ table td[class*="col-"], table th[class*="col-"] {
}
.table-responsive {
min-height: .01%;
display: block;
width: 100%;
overflow-x: auto;
}
@media screen and (max-width: 33.9em) {
.table-responsive {
width: 100%;
margin-bottom: 1rem;
overflow-y: hidden;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #eceeef;
}
.table-responsive > .table {
margin-bottom: 0;
}
.table-responsive > .table > thead > tr > th, .table-responsive > .table > thead > tr > td, .table-responsive > .table > tbody > tr > th, .table-responsive > .table > tbody > tr > td, .table-responsive > .table > tfoot > tr > th, .table-responsive > .table > tfoot > tr > td {
white-space: nowrap;
}
.table-responsive > .table-bordered {
border: 0;
}
.table-responsive > .table-bordered > thead > tr > th:first-child, .table-responsive > .table-bordered > thead > tr > td:first-child, .table-responsive > .table-bordered > tbody > tr > th:first-child, .table-responsive > .table-bordered > tbody > tr > td:first-child, .table-responsive > .table-bordered > tfoot > tr > th:first-child, .table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0;
}
.table-responsive > .table-bordered > thead > tr > th:last-child, .table-responsive > .table-bordered > thead > tr > td:last-child, .table-responsive > .table-bordered > tbody > tr > th:last-child, .table-responsive > .table-bordered > tbody > tr > td:last-child, .table-responsive > .table-bordered > tfoot > tr > th:last-child, .table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0;
}
.table-responsive > .table-bordered > tbody > tr:last-child > th, .table-responsive > .table-bordered > tbody > tr:last-child > td, .table-responsive > .table-bordered > tfoot > tr:last-child > th, .table-responsive > .table-bordered > tfoot > tr:last-child > td {
border-bottom: 0;
}
}
.table > .thead-inverse > tr > th {
.thead-inverse th {
color: #fff;
background-color: #373a3c;
}
.table > .thead-default > tr > th {
.thead-default th {
color: #55595c;
background-color: #eceeef;
}
@ -1859,7 +1836,7 @@ table td[class*="col-"], table th[class*="col-"] {
.table-inverse.table-bordered {
border: 0;
}
.table-inverse > thead > tr > th, .table-inverse > thead > tr > td, .table-inverse > tbody > tr > th, .table-inverse > tbody > tr > td {
.table-inverse th, .table-inverse td {
border-color: #55595c;
}
@ -1870,14 +1847,14 @@ table td[class*="col-"], table th[class*="col-"] {
display: block;
white-space: nowrap;
}
.table-reflow > thead > tr > th, .table-reflow > thead > tr > td, .table-reflow > tbody > tr > th, .table-reflow > tbody > tr > td, .table-reflow > tfoot > tr > th, .table-reflow > tfoot > tr > td {
.table-reflow th, .table-reflow td {
border-top: 1px solid #eceeef;
border-left: 1px solid #eceeef;
}
.table-reflow > thead > tr > th:last-child, .table-reflow > thead > tr > td:last-child, .table-reflow > tbody > tr > th:last-child, .table-reflow > tbody > tr > td:last-child, .table-reflow > tfoot > tr > th:last-child, .table-reflow > tfoot > tr > td:last-child {
.table-reflow th:last-child, .table-reflow td:last-child {
border-right: 1px solid #eceeef;
}
.table-reflow > thead:last-child > tr:last-child > th, .table-reflow > thead:last-child > tr:last-child > td, .table-reflow > tbody:last-child > tr:last-child > th, .table-reflow > tbody:last-child > tr:last-child > td, .table-reflow > tfoot:last-child > tr:last-child > th, .table-reflow > tfoot:last-child > tr:last-child > td {
.table-reflow thead:last-child tr:last-child th, .table-reflow thead:last-child tr:last-child td, .table-reflow tbody:last-child tr:last-child th, .table-reflow tbody:last-child tr:last-child td, .table-reflow tfoot:last-child tr:last-child th, .table-reflow tfoot:last-child tr:last-child td {
border-bottom: 1px solid #eceeef;
}
.table-reflow tr {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,82 +1,63 @@
//
// Tables
// --------------------------------------------------
// Reset tabular elements
//
table {
background-color: $table-bg;
}
caption {
padding-top: $table-cell-padding;
padding-bottom: $table-cell-padding;
color: $text-muted;
text-align: left;
}
th {
text-align: left;
}
// Baseline styles
//
// Basic tables
//
.table {
width: 100%;
max-width: 100%;
margin-bottom: $spacer;
// Cells
> thead,
> tbody,
> tfoot {
> tr {
> th,
> td {
padding: $table-cell-padding;
line-height: $line-height-base;
vertical-align: top;
border-top: 1px solid $table-border-color;
}
}
th,
td {
padding: $table-cell-padding;
line-height: $line-height-base;
vertical-align: top;
border-top: 1px solid $table-border-color;
}
// Bottom align for column headings
> thead > tr > th {
thead th {
vertical-align: bottom;
border-bottom: 2px solid $table-border-color;
}
// Remove top border from thead by default
// > caption + thead,
// > colgroup + thead,
// > thead:first-child {
// > tr:first-child {
// > th,
// > td {
// border-top: 0;
// }
// }
// }
// Account for multiple tbody instances
> tbody + tbody {
tbody + tbody {
border-top: 2px solid $table-border-color;
}
// Nesting
// .table {
// background-color: $body-bg;
// }
.table {
background-color: $body-bg;
}
}
//
// Condensed table w/ half padding
//
.table-sm {
> thead,
> tbody,
> tfoot {
> tr {
> th,
> td {
padding: $table-sm-cell-padding;
}
}
th,
td {
padding: $table-sm-cell-padding;
}
}
@ -87,19 +68,15 @@ th {
.table-bordered {
border: 1px solid $table-border-color;
> thead,
> tbody,
> tfoot {
> tr {
> th,
> td {
border: 1px solid $table-border-color;
}
}
th,
td {
border: 1px solid $table-border-color;
}
> thead > tr {
> th,
> td {
thead {
th,
td {
border-bottom-width: 2px;
}
}
@ -111,7 +88,7 @@ th {
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.table-striped {
> tbody > tr:nth-child(odd) {
tbody tr:nth-child(odd) {
background-color: $table-bg-accent;
}
}
@ -122,7 +99,7 @@ th {
// Placed here since it has to come after the potential zebra striping
.table-hover {
> tbody > tr:hover {
tbody tr:hover {
background-color: $table-bg-hover;
}
}
@ -170,79 +147,26 @@ table {
// will display normally.
.table-responsive {
min-height: 0.01%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837)
display: block;
width: 100%;
overflow-x: auto;
@media screen and (max-width: $screen-xs-max) {
width: 100%;
margin-bottom: $spacer;
overflow-y: hidden;
border: 1px solid $table-border-color;
-ms-overflow-style: -ms-autohiding-scrollbar;
// Tighten up spacing
> .table {
margin-bottom: 0;
// Ensure the content doesn't wrap
> thead,
> tbody,
> tfoot {
> tr {
> th,
> td {
white-space: nowrap;
}
}
}
}
// Special overrides for the bordered tables
> .table-bordered {
border: 0;
// Nuke the appropriate borders so that the parent can handle them
> thead,
> tbody,
> tfoot {
> tr {
> th:first-child,
> td:first-child {
border-left: 0;
}
> th:last-child,
> td:last-child {
border-right: 0;
}
}
}
// Only nuke the last row's bottom-border in `tbody` and `tfoot` since
// chances are there will be only one `tr` in a `thead` and that would
// remove the border altogether.
> tbody,
> tfoot {
> tr:last-child {
> th,
> td {
border-bottom: 0;
}
}
}
}
}
// Todo: find out if we need this still.
//
// border: 1px solid $table-border-color;
// -ms-overflow-style: -ms-autohiding-scrollbar;
// min-height: 0.01%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837)
}
.table > .thead-inverse {
> tr > th {
.thead-inverse {
th {
color: #fff;
background-color: $gray-dark;
}
}
.table > .thead-default {
> tr > th {
.thead-default {
th {
color: $gray;
background-color: $gray-lighter;
}
@ -256,20 +180,14 @@ table {
border: 0;
}
> thead,
> tbody {
> tr {
> th,
> td {
border-color: $gray;
}
}
th,
td {
border-color: $gray;
}
}
.table-reflow {
thead {
float: left;
}
@ -279,25 +197,23 @@ table {
white-space: nowrap;
}
> thead,
> tbody,
> tfoot {
> tr {
> th,
> td {
border-top: 1px solid $table-border-color;
border-left: 1px solid $table-border-color;
&:last-child {
border-right: 1px solid $table-border-color;
}
}
}
th,
td {
border-top: 1px solid $table-border-color;
border-left: 1px solid $table-border-color;
&:last-child {
> tr:last-child {
> th,
> td {
border-right: 1px solid $table-border-color;
}
}
thead,
tbody,
tfoot {
&:last-child {
tr:last-child {
th,
td {
border-bottom: 1px solid $table-border-color;
}
}