// Cards $grid-gutter-width-base: 30px; $card-spacer-x: 1.25rem !default; $card-spacer-y: .75rem !default; $card-border-width: 1px !default; $card-border-radius: $border-rad-light; $card-border-color: rgba($black,.125) !default; $card-border-radius-inner: calc(#{$card-border-radius} - #{$card-border-width}) !default; $card-cap-bg: $gray-1; $card-bg: $white !default; $card-link-hover-color: $white !default; $card-img-overlay-padding: 1.25rem !default; $card-deck-margin: ($grid-gutter-width-base / 2) !default; $card-columns-count: 3 !default; $card-columns-gap: 1.25rem !default; $card-columns-margin: $card-spacer-y !default; // Card variants @mixin card-variant($background, $border) { background-color: $background; border-color: $border; .card-header, .card-footer { background-color: transparent; } } @mixin card-outline-variant($color) { background-color: transparent; border-color: $color; } // // Inverse text within a card for use with dark backgrounds // @mixin card-inverse { color: rgba(255,255,255,.65); .card-header, .card-footer { background-color: transparent; border-color: rgba(255,255,255,.2); } .card-header, .card-footer, .card-title, .card-blockquote { color: #fff; } .card-link, .card-text, .card-subtitle, .card-blockquote .blockquote-footer { color: rgba(255,255,255,.65); } .card-link { @include hover-focus { color: $card-link-hover-color; } } } // // Base styles // @mixin aside-flush { padding: 0; border-radius: 0; background: none; .card-img-top { border-radius: 0; } .card-block { flex: 0; } } .card { position: relative; display: flex; flex-direction: column; background-color: $card-bg; border: $card-border-width solid $card-border-color; border-radius: $card-border-radius; &-aside-flush-left { @include aside-flush; border-width: 0 1px 0 0; } &-aside-flush-right { @include aside-flush; border-width: 0 0 0 1px; } &-block { flex: 1 1 auto; padding: $card-spacer-x; &-separator { padding: $card-spacer-x 0; border-top: $card-border-width solid $card-border-color; border-bottom: $card-border-width solid $card-border-color; @include clearfix; &-group { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; .card-block-separator { flex: 1 0 0; &:not(:first-child) { border-left: $card-border-width solid $card-border-color; padding-left: $card-spacer-x; } &:first-child { padding-right: $card-spacer-x; } } } } &:last-child .card-block-separator { padding: $card-spacer-x 0 0; border-bottom: 0; } } } .card-title { margin-bottom: $card-spacer-y; } .card-subtitle { margin-top: -($card-spacer-y / 2); margin-bottom: 0; } .card-text:last-child { margin-bottom: 0; } .card-link { &:hover { text-decoration: none; } + .card-link { margin-left: $card-spacer-x; } } .card { > .list-group:first-child { .list-group-item:first-child { @include border-top-radius($card-border-radius); } } > .list-group:last-child { .list-group-item:last-child { @include border-bottom-radius($card-border-radius); } } } // // Optional textual caps // .card-header { padding: $card-spacer-y $card-spacer-x; margin-bottom: 0; // Removes the default margin-bottom of background-color: $card-cap-bg; border-bottom: $card-border-width solid $card-border-color; &:first-child { @include border-radius($card-border-radius-inner $card-border-radius-inner 0 0); } } .card-footer { padding: $card-spacer-y $card-spacer-x; background-color: $card-cap-bg; border-top: $card-border-width solid $card-border-color; &:last-child { @include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner); } } // // Header navs // .card-header-tabs { margin-right: -($card-spacer-x / 2); margin-bottom: -$card-spacer-y; margin-left: -($card-spacer-x / 2); border-bottom: 0; } .card-header-pills { margin-right: -($card-spacer-x / 2); margin-left: -($card-spacer-x / 2); } // // Background variations // .card-primary { @include card-variant($brand-primary, $brand-primary); } .card-success { @include card-variant($brand-success, $brand-success); } .card-info { @include card-variant($brand-info, $brand-info); } .card-warning { @include card-variant($brand-warning, $brand-warning); } .card-danger { @include card-variant($brand-danger, $brand-danger); } // Remove all backgrounds .card-outline-primary { @include card-outline-variant($power-royal); } .card-outline-secondary { @include card-outline-variant($gray-2); } .card-outline-info { @include card-outline-variant($power-blue); } .card-outline-success { @include card-outline-variant($power-royal); } .card-outline-warning { @include card-outline-variant($power-red); } .card-outline-danger { @include card-outline-variant($power-gold); } // // Inverse text within a card for use with dark backgrounds // .card-inverse { @include card-inverse; } // // Blockquote // .card-blockquote { padding: 0; margin-bottom: 0; border-left: 0; } // Card image .card-img { // margin: -1.325rem; @include border-radius($card-border-radius-inner); } .card-img-overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; padding: $card-img-overlay-padding; } // Card image caps .card-img-top { @include border-top-radius($card-border-radius-inner); } .card-img-bottom { @include border-bottom-radius($card-border-radius-inner); } // Card deck @include media-breakpoint-up(sm) { .card-deck { display: flex; flex-flow: row wrap; .card { display: flex; flex: 1 0 0; flex-direction: column; // Selectively apply horizontal margins to cards to avoid doing the // negative margin dance like our grid. This differs from the grid // due to the use of margins as gutters instead of padding. &:not(:first-child) { margin-left: $card-deck-margin; } &:not(:last-child) { margin-right: $card-deck-margin; } } } } // // Card groups // @include media-breakpoint-up(sm) { .card-group { display: flex; flex-flow: row wrap; .card { flex: 1 0 0; + .card { margin-left: 0; border-left: 0; } // Handle rounded corners &:first-child { @include border-right-radius(0); .card-img-top { border-top-right-radius: 0; } .card-img-bottom { border-bottom-right-radius: 0; } } &:last-child { @include border-left-radius(0); .card-img-top { border-top-left-radius: 0; } .card-img-bottom { border-bottom-left-radius: 0; } } &:not(:first-child):not(:last-child) { border-radius: 0; .card-img-top, .card-img-bottom { border-radius: 0; } } } } } // // Columns // @include media-breakpoint-up(sm) { .card-columns { column-count: $card-columns-count; column-gap: $card-columns-gap; .card { display: inline-block; // Don't let them vertically span multiple columns width: 100%; // Don't let their width change margin-bottom: $card-columns-margin; } } }