card.md 26.5 KB
Newer Older
Mark Otto's avatar
cards  
Mark Otto committed
1
---
Mark Otto's avatar
Mark Otto committed
2
layout: docs
Mark Otto's avatar
cards  
Mark Otto committed
3
title: Cards
Quy's avatar
Quy committed
4
description: Bootstrap's cards provide a flexible and extensible content container with multiple variants and options.
5
group: components
Mark Otto's avatar
Mark Otto committed
6
toc: true
Mark Otto's avatar
cards  
Mark Otto committed
7
8
---

Mark Otto's avatar
Mark Otto committed
9
10
## About

Mark Otto's avatar
Mark Otto committed
11
A **card** is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options. If you're familiar with Bootstrap 3, cards replace our old panels, wells, and thumbnails. Similar functionality to those components is available as modifier classes for cards.
Mark Otto's avatar
cards  
Mark Otto committed
12

13
## Example
Mark Otto's avatar
cards  
Mark Otto committed
14

15
Cards are built with as little markup and styles as possible, but still manage to deliver a ton of control and customization. Built with flexbox, they offer easy alignment and mix well with other Bootstrap components. They have no `margin` by default, so use [spacing utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/) as needed.
Mark Otto's avatar
Mark Otto committed
16

Quy's avatar
Quy committed
17
Below is an example of a basic card with mixed content and a fixed width. Cards have no fixed width to start, so they'll naturally fill the full width of its parent element. This is easily customized with our various [sizing options](#sizing).
Mark Otto's avatar
cards  
Mark Otto committed
18

m5o's avatar
m5o committed
19
{% capture example %}
20
<div class="card" style="width: 18rem;">
XhmikosR's avatar
XhmikosR committed
21
  <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
22
  <div class="card-body">
23
    <h5 class="card-title">Card title</h5>
24
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
25
    <a href="#" class="btn btn-primary">Go somewhere</a>
26
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
27
</div>
m5o's avatar
m5o committed
28
29
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
30

31
## Content types
Mark Otto's avatar
Mark Otto committed
32

33
Cards support a wide variety of content, including images, text, list groups, links, and more. Below are examples of what's supported.
Mark Otto's avatar
Mark Otto committed
34

35
### Body
Mark Otto's avatar
Mark Otto committed
36

37
The building block of a card is the `.card-body`. Use it whenever you need a padded section within a card.
38

m5o's avatar
m5o committed
39
{% capture example %}
40
<div class="card">
41
  <div class="card-body">
42
    This is some text within a card body.
43
  </div>
Mark Otto's avatar
Mark Otto committed
44
</div>
m5o's avatar
m5o committed
45
46
{% endcapture %}
{% include example.html content=example %}
47

48
### Titles, text, and links
49

XhmikosR's avatar
XhmikosR committed
50
Card titles are used by adding `.card-title` to a `<h*>` tag. In the same way, links are added and placed next to each other by adding `.card-link` to an `<a>` tag.
51

52
Subtitles are used by adding a `.card-subtitle` to a `<h*>` tag. If the `.card-title` and the `.card-subtitle` items are placed in a `.card-body` item, the card title and subtitle are aligned nicely.
53

m5o's avatar
m5o committed
54
{% capture example %}
55
<div class="card" style="width: 18rem;">
56
  <div class="card-body">
57
    <h5 class="card-title">Card title</h5>
58
    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
59
60
61
62
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="card-link">Card link</a>
    <a href="#" class="card-link">Another link</a>
  </div>
Mark Otto's avatar
Mark Otto committed
63
</div>
m5o's avatar
m5o committed
64
65
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
Mark Otto committed
66

67
### Images
68

69
`.card-img-top` places an image to the top of the card. With `.card-text`, text can be added to the card. Text within `.card-text` can also be styled with the standard HTML tags.
Mark Otto's avatar
Mark Otto committed
70

m5o's avatar
m5o committed
71
{% capture example %}
72
<div class="card" style="width: 18rem;">
73
  <img class="card-img-top" data-src="holder.js/100px180/?text=Image cap" alt="Card image cap">
74
  <div class="card-body">
75
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
Mark Otto's avatar
Mark Otto committed
76
77
  </div>
</div>
m5o's avatar
m5o committed
78
79
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
Mark Otto committed
80

81
82
83
### List groups

Create lists of content in a card with a flush list group.
Mark Otto's avatar
Mark Otto committed
84

m5o's avatar
m5o committed
85
{% capture example %}
86
<div class="card" style="width: 18rem;">
87
88
89
90
91
  <ul class="list-group list-group-flush">
    <li class="list-group-item">Cras justo odio</li>
    <li class="list-group-item">Dapibus ac facilisis in</li>
    <li class="list-group-item">Vestibulum at eros</li>
  </ul>
Mark Otto's avatar
Mark Otto committed
92
</div>
m5o's avatar
m5o committed
93
94
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
Mark Otto committed
95

m5o's avatar
m5o committed
96
{% capture example %}
97
<div class="card" style="width: 18rem;">
98
99
100
101
102
103
104
105
106
  <div class="card-header">
    Featured
  </div>
  <ul class="list-group list-group-flush">
    <li class="list-group-item">Cras justo odio</li>
    <li class="list-group-item">Dapibus ac facilisis in</li>
    <li class="list-group-item">Vestibulum at eros</li>
  </ul>
</div>
m5o's avatar
m5o committed
107
108
{% endcapture %}
{% include example.html content=example %}
109

110
### Kitchen sink
Mark Otto's avatar
cards  
Mark Otto committed
111

112
Mix and match multiple content types to create the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card.
Mark Otto's avatar
cards  
Mark Otto committed
113

m5o's avatar
m5o committed
114
{% capture example %}
115
<div class="card" style="width: 18rem;">
116
  <img class="card-img-top" data-src="holder.js/100px180/?text=Image cap" alt="Card image cap">
117
  <div class="card-body">
118
    <h5 class="card-title">Card title</h5>
119
120
121
122
123
124
125
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
  </div>
  <ul class="list-group list-group-flush">
    <li class="list-group-item">Cras justo odio</li>
    <li class="list-group-item">Dapibus ac facilisis in</li>
    <li class="list-group-item">Vestibulum at eros</li>
  </ul>
126
  <div class="card-body">
127
128
129
    <a href="#" class="card-link">Card link</a>
    <a href="#" class="card-link">Another link</a>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
130
</div>
m5o's avatar
m5o committed
131
132
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
133

134
### Header and footer
Mark Otto's avatar
cards  
Mark Otto committed
135
136
137

Add an optional header and/or footer within a card.

m5o's avatar
m5o committed
138
{% capture example %}
Mark Otto's avatar
cards  
Mark Otto committed
139
140
141
142
<div class="card">
  <div class="card-header">
    Featured
  </div>
143
  <div class="card-body">
144
    <h5 class="card-title">Special title treatment</h5>
145
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
146
147
148
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
m5o's avatar
m5o committed
149
150
{% endcapture %}
{% include example.html content=example %}
151

152
153
Card headers can be styled by adding `.card-header` to `<h*>` elements.

m5o's avatar
m5o committed
154
{% capture example %}
155
<div class="card">
156
  <h5 class="card-header">Featured</h5>
157
  <div class="card-body">
158
    <h5 class="card-title">Special title treatment</h5>
159
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
160
161
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
162
</div>
m5o's avatar
m5o committed
163
164
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
165

m5o's avatar
m5o committed
166
{% capture example %}
Mark Otto's avatar
cards  
Mark Otto committed
167
168
169
170
<div class="card">
  <div class="card-header">
    Quote
  </div>
171
  <div class="card-body">
172
    <blockquote class="blockquote mb-0">
173
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
174
      <footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
175
176
    </blockquote>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
177
</div>
m5o's avatar
m5o committed
178
179
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
180

m5o's avatar
m5o committed
181
{% capture example %}
182
<div class="card text-center">
Mark Otto's avatar
cards  
Mark Otto committed
183
184
185
  <div class="card-header">
    Featured
  </div>
186
  <div class="card-body">
187
    <h5 class="card-title">Special title treatment</h5>
188
189
190
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
191
192
193
194
  <div class="card-footer text-muted">
    2 days ago
  </div>
</div>
m5o's avatar
m5o committed
195
196
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
197

198
## Sizing
199

200
201
202
203
204
205
Cards assume no specific `width` to start, so they'll be 100% wide unless otherwise stated. You can change this as needed with custom CSS, grid classes, grid Sass mixins, or utilities.

### Using grid markup

Using the grid, wrap cards in columns and rows as needed.

m5o's avatar
m5o committed
206
{% capture example %}
207
208
209
<div class="row">
  <div class="col-sm-6">
    <div class="card">
210
      <div class="card-body">
211
        <h5 class="card-title">Special title treatment</h5>
212
213
214
215
216
217
218
        <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
      </div>
    </div>
  </div>
  <div class="col-sm-6">
    <div class="card">
219
      <div class="card-body">
220
        <h5 class="card-title">Special title treatment</h5>
221
222
223
224
225
226
        <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
      </div>
    </div>
  </div>
</div>
m5o's avatar
m5o committed
227
228
{% endcapture %}
{% include example.html content=example %}
229
230
231

### Using utilities

Mark Otto's avatar
Mark Otto committed
232
Use our handful of [available sizing utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/sizing/) to quickly set a card's width.
233

m5o's avatar
m5o committed
234
{% capture example %}
235
<div class="card w-75">
236
  <div class="card-body">
237
    <h5 class="card-title">Card title</h5>
238
239
240
241
242
243
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Button</a>
  </div>
</div>

<div class="card w-50">
244
  <div class="card-body">
245
    <h5 class="card-title">Card title</h5>
246
247
248
249
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Button</a>
  </div>
</div>
m5o's avatar
m5o committed
250
251
{% endcapture %}
{% include example.html content=example %}
252
253
254
255
256

### Using custom CSS

Use custom CSS in your stylesheets or as inline styles to set a width.

m5o's avatar
m5o committed
257
{% capture example %}
258
<div class="card" style="width: 18rem;">
259
  <div class="card-body">
260
    <h5 class="card-title">Special title treatment</h5>
261
262
263
264
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
m5o's avatar
m5o committed
265
266
{% endcapture %}
{% include example.html content=example %}
267

268
269
## Text alignment

270
You can quickly change the text alignment of any card—in its entirety or specific parts—with our [text align classes]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/text/#text-alignment).
271

m5o's avatar
m5o committed
272
{% capture example %}
273
<div class="card" style="width: 18rem;">
274
  <div class="card-body">
275
    <h5 class="card-title">Special title treatment</h5>
276
277
278
279
280
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>

281
<div class="card text-center" style="width: 18rem;">
282
  <div class="card-body">
283
    <h5 class="card-title">Special title treatment</h5>
284
285
286
287
288
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>

289
<div class="card text-right" style="width: 18rem;">
290
  <div class="card-body">
291
    <h5 class="card-title">Special title treatment</h5>
292
293
294
295
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
m5o's avatar
m5o committed
296
297
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
Mark Otto committed
298
299
300

## Navigation

Mark Otto's avatar
Mark Otto committed
301
Add some navigation to a card's header (or block) with Bootstrap's [nav components]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/navs/).
Mark Otto's avatar
Mark Otto committed
302

m5o's avatar
m5o committed
303
{% capture example %}
304
<div class="card text-center">
305
  <div class="card-header">
306
    <ul class="nav nav-tabs card-header-tabs">
307
308
309
310
311
312
313
314
315
316
317
      <li class="nav-item">
        <a class="nav-link active" href="#">Active</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
      </li>
    </ul>
  </div>
318
  <div class="card-body">
319
    <h5 class="card-title">Special title treatment</h5>
320
321
322
323
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
m5o's avatar
m5o committed
324
325
{% endcapture %}
{% include example.html content=example %}
326

m5o's avatar
m5o committed
327
{% capture example %}
328
<div class="card text-center">
329
  <div class="card-header">
330
    <ul class="nav nav-pills card-header-pills">
331
332
333
334
335
336
337
338
339
340
341
      <li class="nav-item">
        <a class="nav-link active" href="#">Active</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
      </li>
    </ul>
  </div>
342
  <div class="card-body">
343
    <h5 class="card-title">Special title treatment</h5>
344
345
346
347
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
m5o's avatar
m5o committed
348
349
{% endcapture %}
{% include example.html content=example %}
350

351
## Images
Mark Otto's avatar
cards  
Mark Otto committed
352

353
354
355
356
357
Cards include a few options for working with images. Choose from appending "image caps" at either end of a card, overlaying images with card content, or simply embedding the image in a card.

### Image caps

Similar to headers and footers, cards can include top and bottom "image caps"—images at the top or bottom of a card.
Mark Otto's avatar
cards  
Mark Otto committed
358

m5o's avatar
m5o committed
359
{% capture example %}
360
<div class="card mb-3">
XhmikosR's avatar
XhmikosR committed
361
  <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
362
  <div class="card-body">
363
    <h5 class="card-title">Card title</h5>
364
365
366
    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
367
368
</div>
<div class="card">
369
  <div class="card-body">
370
    <h5 class="card-title">Card title</h5>
371
372
373
    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
  </div>
XhmikosR's avatar
XhmikosR committed
374
  <img class="card-img-bottom" data-src="holder.js/100px180/" alt="Card image cap">
Mark Otto's avatar
cards  
Mark Otto committed
375
</div>
m5o's avatar
m5o committed
376
377
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
378

379
### Image overlays
Mark Otto's avatar
cards  
Mark Otto committed
380

Mark Otto's avatar
Mark Otto committed
381
Turn an image into a card background and overlay your card's text. Depending on the image, you may or may not need additional styles or utilities.
Mark Otto's avatar
cards  
Mark Otto committed
382

m5o's avatar
m5o committed
383
{% capture example %}
384
<div class="card bg-dark text-white">
385
  <img class="card-img" data-src="holder.js/100px270?text=Card image" alt="Card image">
Mark Otto's avatar
cards  
Mark Otto committed
386
  <div class="card-img-overlay">
387
    <h5 class="card-title">Card title</h5>
Mark Otto's avatar
cards  
Mark Otto committed
388
    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
Mark Otto's avatar
Mark Otto committed
389
    <p class="card-text">Last updated 3 mins ago</p>
Mark Otto's avatar
cards  
Mark Otto committed
390
391
  </div>
</div>
m5o's avatar
m5o committed
392
393
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
394

395
396
397
398
## Card styles

Cards include various options for customizing their backgrounds, borders, and color.

399
### Background and color
Mark Otto's avatar
cards  
Mark Otto committed
400

401
Use [text and background utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/colors/) to change the appearance of a card.
Mark Otto's avatar
cards  
Mark Otto committed
402

m5o's avatar
m5o committed
403
{% capture example %}
404
{% for color in site.data.theme-colors %}
405
<div class="card{% unless color.name == "light" %} text-white{% endunless %} bg-{{ color.name }} mb-3" style="max-width: 18rem;">
Mark Otto's avatar
Mark Otto committed
406
  <div class="card-header">Header</div>
407
  <div class="card-body">
408
    <h5 class="card-title">{{ color.name | capitalize }} card title</h5>
409
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
410
  </div>
411
</div>{% endfor %}
m5o's avatar
m5o committed
412
413
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
414

415
{% include callout-warning-color-assistive-technologies.md %}
Mark Otto's avatar
cards  
Mark Otto committed
416

417
418
419
### Border

Use [border utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/borders/) to change just the `border-color` of a card. Note that you can put `.text-{color}` classes on the parent `.card` or a subset of the card's contents as shown below.
Mark Otto's avatar
cards  
Mark Otto committed
420

m5o's avatar
m5o committed
421
{% capture example %}
422
{% for color in site.data.theme-colors %}
423
<div class="card border-{{ color.name }} mb-3" style="max-width: 18rem;">
424
425
  <div class="card-header">Header</div>
  <div class="card-body{% unless color.name == "light" %} text-{{ color.name }}{% endunless %}">
426
    <h5 class="card-title">{{ color.name | capitalize }} card title</h5>
427
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
petetnt's avatar
petetnt committed
428
  </div>
429
</div>{% endfor %}
m5o's avatar
m5o committed
430
431
{% endcapture %}
{% include example.html content=example %}
petetnt's avatar
petetnt committed
432

433
### Mixins utilities
434

435
You can also change the borders on the card header and footer as needed, and even remove their `background-color` with `.bg-transparent`.
petetnt's avatar
petetnt committed
436

m5o's avatar
m5o committed
437
{% capture example %}
438
<div class="card border-success mb-3" style="max-width: 18rem;">
439
440
  <div class="card-header bg-transparent border-success">Header</div>
  <div class="card-body text-success">
441
    <h5 class="card-title">Success card title</h5>
442
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
443
  </div>
444
  <div class="card-footer bg-transparent border-success">Footer</div>
Mark Otto's avatar
cards  
Mark Otto committed
445
</div>
m5o's avatar
m5o committed
446
447
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
448

449
## Card layout
Mark Otto's avatar
cards  
Mark Otto committed
450

451
In addition to styling the content within cards, Bootstrap includes a few options for laying out series of cards. For the time being, **these layout options are not yet responsive**.
Mark Otto's avatar
cards  
Mark Otto committed
452

453
454
455
### Card groups

Use card groups to render cards as a single, attached element with equal width and height columns. Card groups use `display: flex;` to achieve their uniform sizing.
456

m5o's avatar
m5o committed
457
{% capture example %}
Mark Otto's avatar
cards  
Mark Otto committed
458
459
<div class="card-group">
  <div class="card">
XhmikosR's avatar
XhmikosR committed
460
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
461
    <div class="card-body">
462
      <h5 class="card-title">Card title</h5>
463
464
465
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
466
467
  </div>
  <div class="card">
XhmikosR's avatar
XhmikosR committed
468
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
469
    <div class="card-body">
470
      <h5 class="card-title">Card title</h5>
471
472
473
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
474
475
  </div>
  <div class="card">
XhmikosR's avatar
XhmikosR committed
476
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
477
    <div class="card-body">
478
      <h5 class="card-title">Card title</h5>
479
480
481
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
482
483
  </div>
</div>
m5o's avatar
m5o committed
484
485
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
486

487
When using card groups with footers, their content will automatically line up.
Mark Otto's avatar
cards  
Mark Otto committed
488

m5o's avatar
m5o committed
489
{% capture example %}
Mark Otto's avatar
Mark Otto committed
490
491
492
<div class="card-group">
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
493
    <div class="card-body">
494
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
495
496
497
498
499
500
501
502
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    </div>
    <div class="card-footer">
      <small class="text-muted">Last updated 3 mins ago</small>
    </div>
  </div>
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
503
    <div class="card-body">
504
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
505
506
507
508
509
510
511
512
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
    </div>
    <div class="card-footer">
      <small class="text-muted">Last updated 3 mins ago</small>
    </div>
  </div>
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
513
    <div class="card-body">
514
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
515
516
517
518
519
520
521
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
    </div>
    <div class="card-footer">
      <small class="text-muted">Last updated 3 mins ago</small>
    </div>
  </div>
</div>
m5o's avatar
m5o committed
522
523
{% endcapture %}
{% include example.html content=example %}
524

Mark Otto's avatar
Mark Otto committed
525
526
### Card decks

527
Need a set of equal width and height cards that aren't attached to one another? Use card decks.
528

m5o's avatar
m5o committed
529
{% capture example %}
530
531
532
<div class="card-deck">
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px200/" alt="Card image cap">
533
    <div class="card-body">
534
      <h5 class="card-title">Card title</h5>
535
536
      <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
Mark Otto's avatar
cards  
Mark Otto committed
537
    </div>
538
539
540
  </div>
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px200/" alt="Card image cap">
541
    <div class="card-body">
542
      <h5 class="card-title">Card title</h5>
543
544
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
Mark Otto's avatar
cards  
Mark Otto committed
545
    </div>
546
547
548
  </div>
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px200/" alt="Card image cap">
549
    <div class="card-body">
550
      <h5 class="card-title">Card title</h5>
551
552
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
Mark Otto's avatar
cards  
Mark Otto committed
553
554
555
    </div>
  </div>
</div>
m5o's avatar
m5o committed
556
557
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
558

Mark Otto's avatar
Mark Otto committed
559
Just like with card groups, card footers in decks will automatically line up.
Mark Otto's avatar
cards  
Mark Otto committed
560

m5o's avatar
m5o committed
561
{% capture example %}
Mark Otto's avatar
Mark Otto committed
562
563
564
<div class="card-deck">
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
565
    <div class="card-body">
566
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
567
568
569
570
571
572
573
574
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    </div>
    <div class="card-footer">
      <small class="text-muted">Last updated 3 mins ago</small>
    </div>
  </div>
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
575
    <div class="card-body">
576
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
577
578
579
580
581
582
583
584
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
    </div>
    <div class="card-footer">
      <small class="text-muted">Last updated 3 mins ago</small>
    </div>
  </div>
  <div class="card">
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
585
    <div class="card-body">
586
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
587
588
589
590
591
592
593
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
    </div>
    <div class="card-footer">
      <small class="text-muted">Last updated 3 mins ago</small>
    </div>
  </div>
</div>
m5o's avatar
m5o committed
594
595
{% endcapture %}
{% include example.html content=example %}
596

597
598
### Card columns

XhmikosR's avatar
XhmikosR committed
599
Cards can be organized into [Masonry](https://masonry.desandro.com/)-like columns with just CSS by wrapping them in `.card-columns`. Cards are built with CSS `column` properties instead of flexbox for easier alignment. Cards are ordered from top to bottom and left to right.
600
601

**Heads up!** Your mileage with card columns may vary. To prevent cards breaking across columns, we must set them to `display: inline-block` as `column-break-inside: avoid` isn't a bulletproof solution yet.
602

m5o's avatar
m5o committed
603
{% capture example %}
Mark Otto's avatar
cards  
Mark Otto committed
604
605
<div class="card-columns">
  <div class="card">
Mark Otto's avatar
Mark Otto committed
606
    <img class="card-img-top" data-src="holder.js/100px160/" alt="Card image cap">
607
    <div class="card-body">
608
      <h5 class="card-title">Card title that wraps to a new line</h5>
609
610
      <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
611
  </div>
612
  <div class="card p-3">
613
    <blockquote class="blockquote mb-0 card-body">
Mark Otto's avatar
cards  
Mark Otto committed
614
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
615
      <footer class="blockquote-footer">
616
617
618
619
        <small class="text-muted">
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
620
621
622
    </blockquote>
  </div>
  <div class="card">
Mark Otto's avatar
Mark Otto committed
623
    <img class="card-img-top" data-src="holder.js/100px160/" alt="Card image cap">
624
    <div class="card-body">
625
      <h5 class="card-title">Card title</h5>
626
627
628
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
629
  </div>
630
  <div class="card bg-primary text-white text-center p-3">
631
    <blockquote class="blockquote mb-0">
632
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
633
      <footer class="blockquote-footer">
634
635
636
637
        <small>
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
638
639
    </blockquote>
  </div>
640
  <div class="card text-center">
641
    <div class="card-body">
642
      <h5 class="card-title">Card title</h5>
643
      <p class="card-text">This card has a regular title and short paragraphy of text below it.</p>
644
645
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
646
  </div>
647
  <div class="card">
Mark Otto's avatar
Mark Otto committed
648
    <img class="card-img" data-src="holder.js/100px260/" alt="Card image">
649
  </div>
650
  <div class="card p-3 text-right">
651
    <blockquote class="blockquote mb-0">
Mark Otto's avatar
cards  
Mark Otto committed
652
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
653
      <footer class="blockquote-footer">
654
655
656
657
        <small class="text-muted">
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
658
659
    </blockquote>
  </div>
660
  <div class="card">
661
    <div class="card-body">
662
      <h5 class="card-title">Card title</h5>
663
      <p class="card-text">This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.</p>
664
665
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
666
667
  </div>
</div>
m5o's avatar
m5o committed
668
669
{% endcapture %}
{% include example.html content=example %}
670
671
672
673
674
675
676
677
678
679
680
681
682

Card columns can also be extended and customized with some additional code. Shown below is an extension of the `.card-columns` class using the same CSS we use—CSS columns— to generate a set of responsive tiers for changing the number of columns.

{% highlight scss %}
.card-columns {
  @include media-breakpoint-only(lg) {
    column-count: 4;
  }
  @include media-breakpoint-only(xl) {
    column-count: 5;
  }
}
{% endhighlight %}