_card.scss 4.81 KB
Newer Older
Mark Otto's avatar
cards  
Mark Otto committed
1
2
3
4
5
6
//
// Base styles
//

.card {
  position: relative;
7
  margin-bottom: $card-spacer-y;
8
  background-color: $card-bg;
9
  border: $card-border-width solid $card-border-color;
10
11
12
13
14
  @include border-radius($card-border-radius);
}

.card-block {
  padding: $card-spacer-x;
Mark Otto's avatar
cards  
Mark Otto committed
15
}
16

Mark Otto's avatar
cards  
Mark Otto committed
17
.card-title {
18
  margin-bottom: $card-spacer-y;
Mark Otto's avatar
cards  
Mark Otto committed
19
}
20
21
22

.card-subtitle {
  margin-top: -($card-spacer-y / 2);
Mark Otto's avatar
cards  
Mark Otto committed
23
24
  margin-bottom: 0;
}
25
26
27

.card-text:last-child {
  margin-bottom: 0;
Mark Otto's avatar
cards  
Mark Otto committed
28
}
29
30
31
32
33
34
35
36
37

// .card-actions {
//   padding: $card-spacer-y $card-spacer-x;

//   .card-link + .card-link {
//     margin-left: $card-spacer-x;
//   }
// }

38
39
40
41
.card-link {
  @include hover {
    text-decoration: none;
  }
Mark Otto's avatar
cards  
Mark Otto committed
42

43
44
45
46
  + .card-link {
    margin-left: $card-spacer-x;
  }
}
Mark Otto's avatar
cards  
Mark Otto committed
47

48
49
50
51
52
53
54
@if $enable-rounded {
  .card {
    > .list-group:first-child {
      .list-group-item:first-child {
        border-radius: $card-border-radius $card-border-radius 0 0;
      }
    }
Mark Otto's avatar
cards  
Mark Otto committed
55

56
57
58
59
60
61
    > .list-group:last-child {
      .list-group-item:last-child {
        border-radius: 0 0 $card-border-radius $card-border-radius;
      }
    }
  }
Mark Otto's avatar
cards  
Mark Otto committed
62
63
64
}


Mark Otto's avatar
Mark Otto committed
65
//
66
// Optional textual caps
Mark Otto's avatar
Mark Otto committed
67
68
//

69
70
.card-header {
  padding: $card-spacer-y $card-spacer-x;
71
72
  background-color: $card-cap-bg;
  border-bottom: $card-border-width solid $card-border-color;
Mark Otto's avatar
Mark Otto committed
73

74
  &:first-child {
75
    @include border-radius($card-border-radius-inner $card-border-radius-inner 0 0);
76
  }
Mark Otto's avatar
Mark Otto committed
77
78
}

79
80
.card-footer {
  padding: $card-spacer-y $card-spacer-x;
81
82
  background-color: $card-cap-bg;
  border-top: $card-border-width solid $card-border-color;
83
84

  &:last-child {
85
    @include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner);
86
  }
Mark Otto's avatar
Mark Otto committed
87
88
89
}


Mark Otto's avatar
cards  
Mark Otto committed
90
91
92
93
94
//
// Background variations
//

.card-primary {
Mark Otto's avatar
Mark Otto committed
95
96
  background-color: $brand-primary;
  border-color: $brand-primary;
Mark Otto's avatar
cards  
Mark Otto committed
97
98
}
.card-success {
Mark Otto's avatar
Mark Otto committed
99
100
  background-color: $brand-success;
  border-color: $brand-success;
Mark Otto's avatar
cards  
Mark Otto committed
101
102
}
.card-info {
Mark Otto's avatar
Mark Otto committed
103
104
  background-color: $brand-info;
  border-color: $brand-info;
Mark Otto's avatar
cards  
Mark Otto committed
105
106
}
.card-warning {
Mark Otto's avatar
Mark Otto committed
107
108
  background-color: $brand-warning;
  border-color: $brand-warning;
Mark Otto's avatar
cards  
Mark Otto committed
109
110
}
.card-danger {
Mark Otto's avatar
Mark Otto committed
111
112
  background-color: $brand-danger;
  border-color: $brand-danger;
Mark Otto's avatar
cards  
Mark Otto committed
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
}


//
// Inverse text within a card for use with dark backgrounds
//

.card-inverse {
  .card-header,
  .card-footer {
    border-bottom: .075rem solid rgba(255,255,255,.2);
  }
  .card-header,
  .card-footer,
  .card-title,
  .card-blockquote {
    color: #fff;
  }
  .card-link,
  .card-text,
  .card-blockquote > footer {
    color: rgba(255,255,255,.65);
  }
136
137
138
139
  .card-link {
    @include hover-focus {
      color: #fff;
    }
Mark Otto's avatar
cards  
Mark Otto committed
140
141
142
143
144
145
146
147
148
149
150
  }
}


//
// Blockquote
//

.card-blockquote {
  padding: 0;
  margin-bottom: 0;
151
  border-left: 0;
Mark Otto's avatar
cards  
Mark Otto committed
152
153
154
155
}

// Card image
.card-img {
156
  // margin: -1.325rem;
Mark Otto's avatar
Mark Otto committed
157
  @include border-radius(.25rem);
Mark Otto's avatar
cards  
Mark Otto committed
158
159
160
161
162
163
164
165
166
167
168
169
170
171
}
.card-img-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 1.25rem;
}



// Card image caps
.card-img-top {
Mark Otto's avatar
Mark Otto committed
172
  @include border-radius(.25rem .25rem 0 0);
Mark Otto's avatar
cards  
Mark Otto committed
173
174
}
.card-img-bottom {
Mark Otto's avatar
Mark Otto committed
175
  @include border-radius(0 0 .25rem .25rem);
Mark Otto's avatar
cards  
Mark Otto committed
176
177
178
179
180
181
182
}


//
// Card set
//

183
@if $enable-flex {
184
185
186
187
188
189
190
191
192
193
194
195
  @include media-breakpoint-up(sm) {
    .card-deck {
      display: flex;
      flex-flow: row wrap;
      margin-right: -.625rem;
      margin-left: -.625rem;

      .card {
        flex: 1 0 0;
        margin-right: .625rem;
        margin-left: .625rem;
      }
196
    }
Mark Otto's avatar
cards  
Mark Otto committed
197
  }
198
} @else {
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
  @include media-breakpoint-up(sm) {
    .card-deck {
      display: table;
      table-layout: fixed;
      border-spacing: 1.25rem 0;

      .card {
        display: table-cell;
        width: 1%;
        vertical-align: top;
      }
    }
    .card-deck-wrapper {
      margin-right: -1.25rem;
      margin-left: -1.25rem;
214
215
216
    }
  }
}
Mark Otto's avatar
cards  
Mark Otto committed
217
218
219
220
221

//
// Card groups
//

222
223
@include media-breakpoint-up(sm) {
  .card-group {
224
    @if $enable-flex {
225
226
      display: flex;
      flex-flow: row wrap;
227
    } @else {
228
229
230
      display: table;
      width: 100%;
      table-layout: fixed;
231
    }
Mark Otto's avatar
cards  
Mark Otto committed
232

233
234
235
236
237
238
239
    .card {
      @if $enable-flex {
        flex: 1 0 0;
      } @else {
        display: table-cell;
        vertical-align: top;
      }
240

241
242
243
      + .card {
        margin-left: 0;
        border-left: 0;
244
      }
245
246
247
248
249
250
251
252
253
254

      // Handle rounded corners
      @if $enable-rounded {
        &:first-child {
          .card-img-top {
            border-top-right-radius: 0;
          }
          .card-img-bottom {
            border-bottom-right-radius: 0;
          }
255
        }
256
257
258
259
260
261
262
        &:last-child {
          .card-img-top {
            border-top-left-radius: 0;
          }
          .card-img-bottom {
            border-bottom-left-radius: 0;
          }
263
        }
264

265
        &:not(:first-child):not(:last-child) {
266
          border-radius: 0;
267
268
269
270
271

          .card-img-top,
          .card-img-bottom {
            border-radius: 0;
          }
272
        }
273
274
      }
    }
Mark Otto's avatar
cards  
Mark Otto committed
275
276
277
278
279
280
281
282
  }
}


//
// Card
//

283
284
285
286
@include media-breakpoint-up(sm) {
  .card-columns {
    column-count: 3;
    column-gap: 1.25rem;
Mark Otto's avatar
cards  
Mark Otto committed
287

288
289
290
291
    .card {
      display: inline-block;
      width: 100%; // Don't let them exceed the column width
    }
Mark Otto's avatar
cards  
Mark Otto committed
292
293
  }
}