card.md 27.7 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;">
21
  {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="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
  {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="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
  {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="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">
361
  {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="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>
374
  {% include icons/placeholder.svg width="100%" height="180" class="card-img-bottom" text="Image cap" title="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
  {% include icons/placeholder.svg width="100%" height="270" class="bd-placeholder-img-lg card-img" text="Card image" title="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 %}
394
395
396
397
398

{% capture callout %}
Note that content should not be larger than the height of the image. If content is larger than the image the content will be displayed outside the image.
{% endcapture %}
{% include callout.html content=callout type="info" %}
Mark Otto's avatar
cards  
Mark Otto committed
399

400
401
402
403
## Card styles

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

404
### Background and color
Mark Otto's avatar
cards  
Mark Otto committed
405

406
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
407

m5o's avatar
m5o committed
408
{% capture example %}
409
{% for color in site.data.theme-colors %}
410
<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
411
  <div class="card-header">Header</div>
412
  <div class="card-body">
413
    <h5 class="card-title">{{ color.name | capitalize }} card title</h5>
414
    <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>
415
  </div>
416
</div>{% endfor %}
m5o's avatar
m5o committed
417
418
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
419

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

422
423
424
### 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
425

m5o's avatar
m5o committed
426
{% capture example %}
427
{% for color in site.data.theme-colors %}
428
<div class="card border-{{ color.name }} mb-3" style="max-width: 18rem;">
429
430
  <div class="card-header">Header</div>
  <div class="card-body{% unless color.name == "light" %} text-{{ color.name }}{% endunless %}">
431
    <h5 class="card-title">{{ color.name | capitalize }} card title</h5>
432
    <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
433
  </div>
434
</div>{% endfor %}
m5o's avatar
m5o committed
435
436
{% endcapture %}
{% include example.html content=example %}
petetnt's avatar
petetnt committed
437

438
### Mixins utilities
439

440
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
441

m5o's avatar
m5o committed
442
{% capture example %}
443
<div class="card border-success mb-3" style="max-width: 18rem;">
444
445
  <div class="card-header bg-transparent border-success">Header</div>
  <div class="card-body text-success">
446
    <h5 class="card-title">Success card title</h5>
447
    <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>
448
  </div>
449
  <div class="card-footer bg-transparent border-success">Footer</div>
Mark Otto's avatar
cards  
Mark Otto committed
450
</div>
m5o's avatar
m5o committed
451
452
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
453

454
## Card layout
Mark Otto's avatar
cards  
Mark Otto committed
455

456
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
457

458
459
460
### 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.
461

m5o's avatar
m5o committed
462
{% capture example %}
Mark Otto's avatar
cards  
Mark Otto committed
463
464
<div class="card-group">
  <div class="card">
465
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
466
    <div class="card-body">
467
      <h5 class="card-title">Card title</h5>
468
469
470
      <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
471
472
  </div>
  <div class="card">
473
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
474
    <div class="card-body">
475
      <h5 class="card-title">Card title</h5>
476
477
478
      <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
479
480
  </div>
  <div class="card">
481
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
482
    <div class="card-body">
483
      <h5 class="card-title">Card title</h5>
484
485
486
      <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
487
488
  </div>
</div>
m5o's avatar
m5o committed
489
490
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
491

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

m5o's avatar
m5o committed
494
{% capture example %}
Mark Otto's avatar
Mark Otto committed
495
496
<div class="card-group">
  <div class="card">
497
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
498
    <div class="card-body">
499
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
500
501
502
503
504
505
506
      <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">
507
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
508
    <div class="card-body">
509
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
510
511
512
513
514
515
516
      <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">
517
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
518
    <div class="card-body">
519
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
520
521
522
523
524
525
526
      <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
527
528
{% endcapture %}
{% include example.html content=example %}
529

Mark Otto's avatar
Mark Otto committed
530
531
### Card decks

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

m5o's avatar
m5o committed
534
{% capture example %}
535
536
<div class="card-deck">
  <div class="card">
537
    {% include icons/placeholder.svg width="100%" height="200" class="card-img-top" text="Image cap" title="Card image cap" %}
538
    <div class="card-body">
539
      <h5 class="card-title">Card title</h5>
540
541
      <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
542
    </div>
543
544
  </div>
  <div class="card">
545
    {% include icons/placeholder.svg width="100%" height="200" class="card-img-top" text="Image cap" title="Card image cap" %}
546
    <div class="card-body">
547
      <h5 class="card-title">Card title</h5>
548
549
      <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
550
    </div>
551
552
  </div>
  <div class="card">
553
    {% include icons/placeholder.svg width="100%" height="200" class="card-img-top" text="Image cap" title="Card image cap" %}
554
    <div class="card-body">
555
      <h5 class="card-title">Card title</h5>
556
557
      <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
558
559
560
    </div>
  </div>
</div>
m5o's avatar
m5o committed
561
562
{% endcapture %}
{% include example.html content=example %}
Mark Otto's avatar
cards  
Mark Otto committed
563

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

m5o's avatar
m5o committed
566
{% capture example %}
Mark Otto's avatar
Mark Otto committed
567
568
<div class="card-deck">
  <div class="card">
569
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
570
    <div class="card-body">
571
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
572
573
574
575
576
577
578
      <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">
579
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
580
    <div class="card-body">
581
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
582
583
584
585
586
587
588
      <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">
589
    {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text="Image cap" title="Card image cap" %}
590
    <div class="card-body">
591
      <h5 class="card-title">Card title</h5>
Mark Otto's avatar
Mark Otto committed
592
593
594
595
596
597
598
      <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
599
600
{% endcapture %}
{% include example.html content=example %}
601

602
603
### Card columns

XhmikosR's avatar
XhmikosR committed
604
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.
605
606

**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.
607

m5o's avatar
m5o committed
608
{% capture example %}
Mark Otto's avatar
cards  
Mark Otto committed
609
610
<div class="card-columns">
  <div class="card">
611
    {% include icons/placeholder.svg width="100%" height="160" class="card-img-top" text="Image cap" title="Card image cap" %}
612
    <div class="card-body">
613
      <h5 class="card-title">Card title that wraps to a new line</h5>
614
615
      <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
616
  </div>
617
  <div class="card p-3">
618
    <blockquote class="blockquote mb-0 card-body">
Mark Otto's avatar
cards  
Mark Otto committed
619
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
620
      <footer class="blockquote-footer">
621
622
623
624
        <small class="text-muted">
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
625
626
627
    </blockquote>
  </div>
  <div class="card">
628
    {% include icons/placeholder.svg width="100%" height="160" class="card-img-top" text="Image cap" title="Card image cap" %}
629
    <div class="card-body">
630
      <h5 class="card-title">Card title</h5>
631
632
633
      <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
634
  </div>
635
  <div class="card bg-primary text-white text-center p-3">
636
    <blockquote class="blockquote mb-0">
637
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
638
      <footer class="blockquote-footer text-white">
639
640
641
642
        <small>
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
643
644
    </blockquote>
  </div>
645
  <div class="card text-center">
646
    <div class="card-body">
647
      <h5 class="card-title">Card title</h5>
648
      <p class="card-text">This card has a regular title and short paragraphy of text below it.</p>
649
650
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
651
  </div>
652
  <div class="card">
653
    {% include icons/placeholder.svg width="100%" height="260" class="card-img" text="Card image" title="Card image" %}
654
  </div>
655
  <div class="card p-3 text-right">
656
    <blockquote class="blockquote mb-0">
Mark Otto's avatar
cards  
Mark Otto committed
657
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
658
      <footer class="blockquote-footer">
659
660
661
662
        <small class="text-muted">
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
663
664
    </blockquote>
  </div>
665
  <div class="card">
666
    <div class="card-body">
667
      <h5 class="card-title">Card title</h5>
668
      <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>
669
670
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
Mark Otto's avatar
cards  
Mark Otto committed
671
672
  </div>
</div>
m5o's avatar
m5o committed
673
674
{% endcapture %}
{% include example.html content=example %}
675
676
677
678
679
680
681
682
683
684
685
686
687

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 %}