You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_card.scss 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. //
  2. // Base styles
  3. //
  4. .card {
  5. position: relative;
  6. display: block;
  7. margin-bottom: $card-spacer-y;
  8. background-color: $card-bg;
  9. border: $card-border-width solid $card-border-color;
  10. @include border-radius($card-border-radius);
  11. }
  12. .card-block {
  13. padding: $card-spacer-x;
  14. }
  15. .card-title {
  16. margin-bottom: $card-spacer-y;
  17. }
  18. .card-subtitle {
  19. margin-top: -($card-spacer-y / 2);
  20. margin-bottom: 0;
  21. }
  22. .card-text:last-child {
  23. margin-bottom: 0;
  24. }
  25. // .card-actions {
  26. // padding: $card-spacer-y $card-spacer-x;
  27. // .card-link + .card-link {
  28. // margin-left: $card-spacer-x;
  29. // }
  30. // }
  31. .card-link {
  32. @include hover {
  33. text-decoration: none;
  34. }
  35. + .card-link {
  36. margin-left: $card-spacer-x;
  37. }
  38. }
  39. @if $enable-rounded {
  40. .card {
  41. > .list-group:first-child {
  42. .list-group-item:first-child {
  43. border-radius: $card-border-radius $card-border-radius 0 0;
  44. }
  45. }
  46. > .list-group:last-child {
  47. .list-group-item:last-child {
  48. border-radius: 0 0 $card-border-radius $card-border-radius;
  49. }
  50. }
  51. }
  52. }
  53. //
  54. // Optional textual caps
  55. //
  56. .card-header {
  57. padding: $card-spacer-y $card-spacer-x;
  58. background-color: $card-cap-bg;
  59. border-bottom: $card-border-width solid $card-border-color;
  60. &:first-child {
  61. @include border-radius($card-border-radius-inner $card-border-radius-inner 0 0);
  62. }
  63. }
  64. .card-footer {
  65. padding: $card-spacer-y $card-spacer-x;
  66. background-color: $card-cap-bg;
  67. border-top: $card-border-width solid $card-border-color;
  68. &:last-child {
  69. @include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner);
  70. }
  71. }
  72. //
  73. // Background variations
  74. //
  75. .card-primary {
  76. @include card-variant($brand-primary, $brand-primary);
  77. }
  78. .card-success {
  79. @include card-variant($brand-success, $brand-success);
  80. }
  81. .card-info {
  82. @include card-variant($brand-info, $brand-info);
  83. }
  84. .card-warning {
  85. @include card-variant($brand-warning, $brand-warning);
  86. }
  87. .card-danger {
  88. @include card-variant($brand-danger, $brand-danger);
  89. }
  90. // Remove all backgrounds
  91. .card-primary-outline {
  92. @include card-outline-variant($btn-primary-bg);
  93. }
  94. .card-secondary-outline {
  95. @include card-outline-variant($btn-secondary-border);
  96. }
  97. .card-info-outline {
  98. @include card-outline-variant($btn-info-bg);
  99. }
  100. .card-success-outline {
  101. @include card-outline-variant($btn-success-bg);
  102. }
  103. .card-warning-outline {
  104. @include card-outline-variant($btn-warning-bg);
  105. }
  106. .card-danger-outline {
  107. @include card-outline-variant($btn-danger-bg);
  108. }
  109. //
  110. // Inverse text within a card for use with dark backgrounds
  111. //
  112. .card-inverse {
  113. @include card-inverse;
  114. }
  115. //
  116. // Blockquote
  117. //
  118. .card-blockquote {
  119. padding: 0;
  120. margin-bottom: 0;
  121. border-left: 0;
  122. }
  123. // Card image
  124. .card-img {
  125. // margin: -1.325rem;
  126. @include border-radius(.25rem);
  127. }
  128. .card-img-overlay {
  129. position: absolute;
  130. top: 0;
  131. right: 0;
  132. bottom: 0;
  133. left: 0;
  134. padding: 1.25rem;
  135. }
  136. // Card image caps
  137. .card-img-top {
  138. @include border-radius($card-border-radius-inner $card-border-radius-inner 0 0);
  139. }
  140. .card-img-bottom {
  141. @include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner);
  142. }
  143. //
  144. // Card set
  145. //
  146. @if $enable-flex {
  147. @include media-breakpoint-up(sm) {
  148. .card-deck {
  149. display: flex;
  150. flex-flow: row wrap;
  151. margin-right: -.625rem;
  152. margin-left: -.625rem;
  153. .card {
  154. flex: 1 0 0;
  155. margin-right: .625rem;
  156. margin-left: .625rem;
  157. }
  158. }
  159. }
  160. } @else {
  161. @include media-breakpoint-up(sm) {
  162. .card-deck {
  163. display: table;
  164. table-layout: fixed;
  165. border-spacing: 1.25rem 0;
  166. .card {
  167. display: table-cell;
  168. width: 1%;
  169. vertical-align: top;
  170. }
  171. }
  172. .card-deck-wrapper {
  173. margin-right: -1.25rem;
  174. margin-left: -1.25rem;
  175. }
  176. }
  177. }
  178. //
  179. // Card groups
  180. //
  181. @include media-breakpoint-up(sm) {
  182. .card-group {
  183. @if $enable-flex {
  184. display: flex;
  185. flex-flow: row wrap;
  186. } @else {
  187. display: table;
  188. width: 100%;
  189. table-layout: fixed;
  190. }
  191. .card {
  192. @if $enable-flex {
  193. flex: 1 0 0;
  194. } @else {
  195. display: table-cell;
  196. vertical-align: top;
  197. }
  198. + .card {
  199. margin-left: 0;
  200. border-left: 0;
  201. }
  202. // Handle rounded corners
  203. @if $enable-rounded {
  204. &:first-child {
  205. @include border-right-radius(0);
  206. .card-img-top {
  207. border-top-right-radius: 0;
  208. }
  209. .card-img-bottom {
  210. border-bottom-right-radius: 0;
  211. }
  212. }
  213. &:last-child {
  214. @include border-left-radius(0);
  215. .card-img-top {
  216. border-top-left-radius: 0;
  217. }
  218. .card-img-bottom {
  219. border-bottom-left-radius: 0;
  220. }
  221. }
  222. &:not(:first-child):not(:last-child) {
  223. border-radius: 0;
  224. .card-img-top,
  225. .card-img-bottom {
  226. border-radius: 0;
  227. }
  228. }
  229. }
  230. }
  231. }
  232. }
  233. //
  234. // Card
  235. //
  236. @include media-breakpoint-up(sm) {
  237. .card-columns {
  238. column-count: 3;
  239. column-gap: 1.25rem;
  240. .card {
  241. display: inline-block;
  242. width: 100%; // Don't let them exceed the column width
  243. }
  244. }
  245. }