1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/scss/_tables.scss

202 lines
3.6 KiB
SCSS
Raw Normal View History

//
// Basic Bootstrap table
//
2011-05-03 21:09:25 -04:00
.table {
2011-05-03 21:09:25 -04:00
width: 100%;
max-width: 100%;
2014-12-04 18:25:57 -05:00
margin-bottom: $spacer;
th,
td {
padding: $table-cell-padding;
vertical-align: top;
2015-11-15 02:24:48 -05:00
border-top: $table-border-width solid $table-border-color;
}
thead th {
vertical-align: bottom;
2015-11-15 02:24:48 -05:00
border-bottom: (2 * $table-border-width) solid $table-border-color;
}
tbody + tbody {
2015-11-15 02:24:48 -05:00
border-top: (2 * $table-border-width) solid $table-border-color;
}
.table {
background-color: $body-bg;
}
}
//
// Condensed table w/ half padding
//
2014-09-18 01:14:27 -04: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 02:24:48 -05:00
border: $table-border-width solid $table-border-color;
th,
td {
2015-11-15 02:24:48 -05:00
border: $table-border-width solid $table-border-color;
}
thead {
th,
td {
2015-11-15 02:24:48 -05:00
border-bottom-width: (2 * $table-border-width);
}
}
2011-05-03 21:09:25 -04:00
}
// Zebra-striping
//
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.table-striped {
tbody tr:nth-of-type(odd) {
2014-12-02 17:02:35 -05: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 17:02:35 -05: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);
// Inverse styles
//
// Same table markup, but inverted color scheme: dark background and light text.
2014-07-14 02:45:34 -04:00
.thead-inverse {
th {
2014-07-14 02:45:34 -04:00
color: #fff;
background-color: $table-bg-inverse;
2014-07-14 02:45:34 -04:00
}
}
.thead-default {
th {
color: $table-head-color;
background-color: $table-head-bg;
2014-07-14 02:45:34 -04:00
}
}
2014-07-14 03:23:46 -04:00
.table-inverse {
color: $body-bg;
background-color: $table-bg-inverse;
2014-07-14 03:23:46 -04:00
th,
2015-01-19 18:52:40 -05:00
td,
thead th {
border-color: $body-bg;
2014-07-14 03:23:46 -04:00
}
&.table-bordered {
border: 0;
}
}
// 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.
.table-responsive {
display: block;
width: 100%;
min-height: 0%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837)
overflow-x: auto;
// TODO: find out if we need this still.
//
// border: $table-border-width solid $table-border-color;
// -ms-overflow-style: -ms-autohiding-scrollbar; // See https://github.com/twbs/bootstrap/pull/10057
// Prevent double border on horizontal scroll due to use of `display: block;`
&.table-bordered {
border: 0;
}
2014-07-14 03:23:46 -04:00
}
.table-reflow {
thead {
float: left;
}
tbody {
display: block;
white-space: nowrap;
}
th,
td {
2015-11-15 02:24:48 -05:00
border-top: $table-border-width solid $table-border-color;
border-left: $table-border-width solid $table-border-color;
&:last-child {
2015-11-15 02:24:48 -05:00
border-right: $table-border-width solid $table-border-color;
}
}
thead,
tbody,
tfoot {
&:last-child {
2016-02-06 15:28:18 -05:00
tr:last-child th,
tr:last-child td {
border-bottom: $table-border-width solid $table-border-color;
}
}
}
tr {
float: left;
th,
td {
display: block !important;
2015-11-15 02:24:48 -05:00
border: $table-border-width solid $table-border-color;
}
}
}