0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00
Bootstrap/scss/_tables.scss

194 lines
3.4 KiB
SCSS
Raw Normal View History

//
// Basic Bootstrap table
//
2011-05-04 03:09:25 +02:00
.table {
2011-05-04 03:09:25 +02:00
width: 100%;
max-width: 100%;
2014-12-05 00:25:57 +01:00
margin-bottom: $spacer;
th,
td {
padding: $table-cell-padding;
2015-06-23 08:24:32 +02:00
line-height: $line-height;
vertical-align: top;
2015-11-15 08:24:48 +01:00
border-top: $table-border-width solid $table-border-color;
}
thead th {
vertical-align: bottom;
2015-11-15 08:24:48 +01:00
border-bottom: (2 * $table-border-width) solid $table-border-color;
}
tbody + tbody {
2015-11-15 08:24:48 +01:00
border-top: (2 * $table-border-width) solid $table-border-color;
}
.table {
background-color: $body-bg;
}
}
//
// Condensed table w/ half padding
//
2014-09-18 07:14:27 +02:00
.table-sm {
th,
td {
padding: $table-sm-cell-padding;
}
}
// Bordered version
//
// Add borders all around the table and between all the columns.
.table-bordered {
2015-11-15 08:24:48 +01:00
border: $table-border-width solid $table-border-color;
th,
td {
2015-11-15 08:24:48 +01:00
border: $table-border-width solid $table-border-color;
}
thead {
th,
td {
2015-11-15 08:24:48 +01:00
border-bottom-width: (2 * $table-border-width);
}
}
2011-05-04 03:09:25 +02:00
}
// Zebra-striping
//
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.table-striped {
tbody tr:nth-of-type(odd) {
2014-12-02 23:02:35 +01:00
background-color: $table-bg-accent;
}
}
// Hover effect
//
// Placed here since it has to come after the potential zebra striping
.table-hover {
tbody tr {
@include hover {
background-color: $table-bg-hover;
}
}
}
// Table backgrounds
//
// Exact selectors below required to override `.table-striped` and prevent
// inheritance to nested tables.
// Generate the contextual variants
2014-12-02 23:02:35 +01:00
@include table-row-variant(active, $table-bg-active);
@include table-row-variant(success, $state-success-bg);
@include table-row-variant(info, $state-info-bg);
@include table-row-variant(warning, $state-warning-bg);
@include table-row-variant(danger, $state-danger-bg);
// Responsive tables
//
// Wrap your tables in `.table-responsive` and we'll make them mobile friendly
// by enabling horizontal scrolling. Only applies <768px. Everything above that
// will display normally.
2014-02-14 19:48:17 +01:00
.table-responsive {
display: block;
width: 100%;
min-height: 0.01%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837)
overflow-x: auto;
// TODO: find out if we need this still.
//
2015-11-15 08:24:48 +01:00
// border: $table-border-width solid $table-border-color;
// -ms-overflow-style: -ms-autohiding-scrollbar; // See https://github.com/twbs/bootstrap/pull/10057
}
2014-07-14 08:45:34 +02:00
.thead-inverse {
th {
2014-07-14 08:45:34 +02:00
color: #fff;
2014-12-02 23:02:35 +01:00
background-color: $gray-dark;
2014-07-14 08:45:34 +02:00
}
}
.thead-default {
th {
2014-12-02 23:02:35 +01:00
color: $gray;
background-color: $gray-lighter;
2014-07-14 08:45:34 +02:00
}
}
2014-07-14 09:23:46 +02:00
.table-inverse {
2014-12-02 23:02:35 +01:00
color: $gray-lighter;
background-color: $gray-dark;
2014-07-14 09:23:46 +02:00
&.table-bordered {
border: 0;
}
th,
2015-01-20 00:52:40 +01:00
td,
thead th {
border-color: $gray;
2014-07-14 09:23:46 +02:00
}
}
.table-reflow {
thead {
float: left;
}
tbody {
display: block;
white-space: nowrap;
}
th,
td {
2015-11-15 08:24:48 +01:00
border-top: $table-border-width solid $table-border-color;
border-left: $table-border-width solid $table-border-color;
&:last-child {
2015-11-15 08:24:48 +01:00
border-right: $table-border-width solid $table-border-color;
}
}
thead,
tbody,
tfoot {
&:last-child {
tr:last-child {
th,
td {
2015-11-15 08:24:48 +01:00
border-bottom: $table-border-width solid $table-border-color;
}
}
}
}
tr {
float: left;
th,
td {
display: block !important;
2015-11-15 08:24:48 +01:00
border: $table-border-width solid $table-border-color;
}
}
}