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

169 lines
3.0 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;
Drop Normalize, port relevant parts to Reboot (#21741) * Get this party started by removing mention of Normalize.css * Nuke the old comment, consolidate to a single line and number as appropriate * Bring over styles for HTML element from Normalize to Reboot * Move margin override for body element from Normalize to Reboot * Drop the block reset for HTML5 elements in IE9- from Normalize given we dropped IE9 support * Building on previous commit, do the same thing for figure, figcaption, and main * Remove IE9- display from Normalize given our browser support * Drop IE8 figure margin because we're IE10+ * No need for the h1 overrides because we reset these font and margin styles anyway in _type.scss already * Drop Safari 6 b and strong normalization because we're Safari 8+ * Remove mark styles for IE9- from Normalize * Remove old iOS audio fixes from Normalize * Remove IE9- display for progress from Normalize * Remove more IE9- rules from Normalize * One more IE9- display removal for canvas element * Move pre overrides from Normalize to Reboot * Move over some link resets to Reboot, drop others - Move over background-color and text-decoration - Drop focus outline change given it affects the offset on hover of focused links * Move over more code element resets, consolidate with pre overrides, too * Move over sub and sup wholesale * Move over img normalization to Reboot * Move over SVG override too * - Drop dupe hidden, but add comment for it - Move over template - Move over summary * Remove bulk of @viewport comment * edit down that code comment * consolidate html-based normalizations * update comments * Consolidate abbr styles * move over more type elements * move over hr changes * move over form controls and more * move over button resets * move over firefox button changes * move over search changes and more * we nuke all these styles for fieldsets anyway, so outright remove them * no need for those, we override them * move over legend, fieldset, progress * line break * delete normalize file * linting * update comment * clarify docs mentions of normalize and reboot * remove normalize excludes from linter * remove normalize excludes from cli task * linting * callout license since we forked part of normalize * Improve comments, move table background reset to .table class instead of in reboot * trailing space
2017-01-21 23:14:25 +01:00
background-color: $table-bg; // Reset for nesting within parents with `background-color`.
2014-12-05 00:25:57 +01:00
th,
td {
padding: $table-cell-padding;
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-cell-padding-sm;
}
}
// 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) {
background-color: $table-accent-bg;
}
}
// Hover effect
//
// Placed here since it has to come after the potential zebra striping
.table-hover {
tbody tr {
@include hover {
background-color: $table-hover-bg;
}
}
}
// Table backgrounds
//
// Exact selectors below required to override `.table-striped` and prevent
// inheritance to nested tables.
2017-06-28 18:36:27 +02:00
@each $color, $value in $theme-colors {
@include table-row-variant($color, theme-color-level($color, -9));
}
@include table-row-variant(active, $table-active-bg);
// Inverse styles
//
// Same table markup, but inverted color scheme: dark background and light text.
2014-07-14 08:45:34 +02:00
.thead-inverse {
th {
color: $table-dark-color;
background-color: $table-dark-bg;
2014-07-14 08:45:34 +02:00
}
}
.thead-default {
th {
color: $table-head-color;
background-color: $table-head-bg;
2014-07-14 08:45:34 +02:00
}
}
2014-07-14 09:23:46 +02:00
.table-inverse {
color: $table-dark-color;
background-color: $table-dark-bg;
2014-07-14 09:23:46 +02:00
th,
2015-01-20 00:52:40 +01:00
td,
thead th {
border-color: $table-dark-border-color;
2014-07-14 09:23:46 +02:00
}
&.table-bordered {
border: 0;
}
&.table-striped {
tbody tr:nth-of-type(odd) {
background-color: $table-dark-accent-bg;
}
}
&.table-hover {
tbody tr {
@include hover {
background-color: $table-dark-hover-bg;
}
}
}
}
// Responsive tables
//
2016-11-26 10:46:11 +01:00
// Add `.table-responsive` to `.table`s and we'll make them mobile friendly by
// enabling horizontal scrolling. Only applies <768px. Everything above that
// will display normally.
.table-responsive {
@include media-breakpoint-down(md) {
display: block;
width: 100%;
overflow-x: auto;
-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 09:23:46 +02:00
}