mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-30 08:39:56 +02:00
Prevent nested tables style leaks
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
// Tables
|
||||
|
||||
@mixin table-row-variant($state, $background, $border: null) {
|
||||
// Exact selectors below required to override `.table-striped` and prevent
|
||||
// inheritance to nested tables.
|
||||
.table-#{$state} {
|
||||
&,
|
||||
> th,
|
||||
> td {
|
||||
background-color: $background;
|
||||
}
|
||||
|
||||
@if $border != null {
|
||||
th,
|
||||
td,
|
||||
thead th,
|
||||
tbody + tbody {
|
||||
border-color: $border;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hover states for `.table-hover`
|
||||
// Note: this is not available for cells or rows within `thead` or `tfoot`.
|
||||
.table-hover {
|
||||
$hover-background: darken($background, 5%);
|
||||
|
||||
.table-#{$state} {
|
||||
&:hover {
|
||||
background-color: $hover-background;
|
||||
|
||||
> td,
|
||||
> th {
|
||||
background-color: $hover-background;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
scss/mixins/_table-variants.scss
Normal file
21
scss/mixins/_table-variants.scss
Normal file
@@ -0,0 +1,21 @@
|
||||
// scss-docs-start table-variant
|
||||
@mixin table-variant($state, $background) {
|
||||
.table-#{$state} {
|
||||
$color: color-contrast(opaque($body-bg, $background));
|
||||
$hover-bg: mix($color, $background, percentage($table-hover-bg-factor));
|
||||
$striped-bg: mix($color, $background, percentage($table-striped-bg-factor));
|
||||
$active-bg: mix($color, $background, percentage($table-active-bg-factor));
|
||||
|
||||
--table-bg: #{$background};
|
||||
--table-striped-bg: #{$striped-bg};
|
||||
--table-striped-color: #{color-contrast($striped-bg)};
|
||||
--table-active-bg: #{$active-bg};
|
||||
--table-active-color: #{color-contrast($active-bg)};
|
||||
--table-hover-bg: #{$hover-bg};
|
||||
--table-hover-color: #{color-contrast($hover-bg)};
|
||||
|
||||
color: $color;
|
||||
border-color: mix($color, $background, percentage($table-border-factor));
|
||||
}
|
||||
}
|
||||
// scss-docs-end table-variant
|
Reference in New Issue
Block a user