card.md 23.6 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
Mark Otto's avatar
Mark Otto committed
4
description: Bootstrap Cards provide a flexible and extensible content container with multiple variants and options.
5
group: components
Mark Otto's avatar
cards  
Mark Otto committed
6
7
8
9
---

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.

Mark Otto's avatar
Mark Otto committed
10
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
11

Mark Otto's avatar
Mark Otto committed
12
13
14
15
16
## Contents

* Will be replaced with the ToC, excluding the "Contents" header
{:toc}

17
## Example
Mark Otto's avatar
cards  
Mark Otto committed
18

19
Cards require a small amount of markup and classes to provide you with as much control as possible. These classes and markup are flexible though and can typically be remixed and extended with ease. For example, if your card has no flush content like images, feel free to put the `.card-block` class on the `.card` element to consolidate your markup.
Mark Otto's avatar
cards  
Mark Otto committed
20
21
22

{% example html %}
<div class="card">
XhmikosR's avatar
XhmikosR committed
23
  <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
24
25
26
  <div class="card-block">
    <h4 class="card-title">Card title</h4>
    <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>
27
    <a href="#" class="btn btn-primary">Go somewhere</a>
28
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
29
30
31
</div>
{% endexample %}

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

34
Cards support a wide variety of content, including images, text, list groups, links, and more. Mix and match multiple content types to create the card you need.
Mark Otto's avatar
Mark Otto committed
35

36
37
{% example html %}
<div class="card">
XhmikosR's avatar
XhmikosR committed
38
  <img class="card-img-top" data-src="holder.js/100px180/?text=Image cap" alt="Card image cap">
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  <div class="card-block">
    <h4 class="card-title">Card title</h4>
    <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>
  <div class="card-block">
    <a href="#" class="card-link">Card link</a>
    <a href="#" class="card-link">Another link</a>
  </div>
</div>
{% endexample %}
Mark Otto's avatar
Mark Otto committed
54

55
56
Lists can be added to a card by adding a list group.

57
58
59
60
61
62
63
64
65
66
{% example html %}
<div class="card">
  <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>
{% endexample %}

67
68
`.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
69
{% example html %}
70
<div class="card">
XhmikosR's avatar
XhmikosR committed
71
  <img class="card-img-top" data-src="holder.js/100px180/?text=Image cap" alt="Card image cap">
72
73
74
  <div class="card-block">
    <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>
Mark Otto's avatar
Mark Otto committed
75
</div>
76
77
{% endexample %}

78
79
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  a `<a>` tag.

80
{% example html %}
81
82
83
84
85
<div class="card card-block">
  <h4 class="card-title">Card title</h4>
  <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>
Mark Otto's avatar
Mark Otto committed
86
</div>
87
88
{% endexample %}

Floris Verburg's avatar
Floris Verburg committed
89
Subtitles are used by adding a `.card-subtitle` to an `<h*>` tag. If the `.card-title` and the `.card-subtitle` items are placed in a `.card-block` item, the card title and subtitle are aligned nicely.
90

Floris Verburg's avatar
Floris Verburg committed
91
The multiple content types can be easily combined to create the card you need. See below for an example.
92

93
94
95
96
97
98
{% example html %}
<div class="card">
  <div class="card-block">
    <h4 class="card-title">Card title</h4>
    <h6 class="card-subtitle text-muted">Support card subtitle</h6>
  </div>
XhmikosR's avatar
XhmikosR committed
99
  <img data-src="holder.js/100px180/?text=Image" alt="Card image">
100
101
102
103
104
  <div class="card-block">
    <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
105
106
107
</div>
{% endexample %}

108
109
## Sizing

110
Constrain the width of cards via custom CSS, our predefined grid classes, or with custom styles using our grid mixins.
Mark Otto's avatar
Mark Otto committed
111
112
113

Using the grid:

Mark Otto's avatar
Mark Otto committed
114
115
116
{% example html %}
<div class="row">
  <div class="col-sm-6">
117
    <div class="card card-block">
Mark Otto's avatar
Mark Otto committed
118
119
120
121
122
123
      <h3 class="card-title">Special title treatment</h3>
      <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 class="col-sm-6">
124
    <div class="card card-block">
Mark Otto's avatar
Mark Otto committed
125
126
127
128
129
130
131
132
      <h3 class="card-title">Special title treatment</h3>
      <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>
{% endexample %}

Mark Otto's avatar
Mark Otto committed
133
134
135
Using custom widths:

{% example html %}
136
<div class="card card-block" style="width: 18rem;">
Mark Otto's avatar
Mark Otto committed
137
138
139
140
141
142
143
  <h3 class="card-title">Special title treatment</h3>
  <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>
{% endexample %}

## Text alignment
Mark Otto's avatar
cards  
Mark Otto committed
144

145
You can quickly change the text alignment of any card—in its entirety or specific parts—with our [text align classes]({{ site.baseurl }}/components/utilities/#text-alignment).
Mark Otto's avatar
cards  
Mark Otto committed
146
147

{% example html %}
148
<div class="card card-block">
Mark Otto's avatar
cards  
Mark Otto committed
149
150
151
152
153
  <h4 class="card-title">Special title treatment</h4>
  <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>

154
<div class="card card-block text-xs-center">
Mark Otto's avatar
cards  
Mark Otto committed
155
156
157
158
159
  <h4 class="card-title">Special title treatment</h4>
  <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>

160
<div class="card card-block text-xs-right">
Mark Otto's avatar
cards  
Mark Otto committed
161
162
163
164
165
166
  <h4 class="card-title">Special title treatment</h4>
  <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>
{% endexample %}

Mark Otto's avatar
Mark Otto committed
167
## Header and footer
Mark Otto's avatar
cards  
Mark Otto committed
168
169
170
171
172
173
174
175

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

{% example html %}
<div class="card">
  <div class="card-header">
    Featured
  </div>
176
177
178
  <div class="card-block">
    <h4 class="card-title">Special title treatment</h4>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
179
180
181
182
183
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
{% endexample %}

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

186
187
188
189
190
191
{% example html %}
<div class="card">
  <h3 class="card-header">Featured</h3>
  <div class="card-block">
    <h4 class="card-title">Special title treatment</h4>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
192
193
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
194
</div>
Mark Otto's avatar
Mark Otto committed
195
{% endexample %}
Mark Otto's avatar
cards  
Mark Otto committed
196

Mark Otto's avatar
Mark Otto committed
197
{% example html %}
Mark Otto's avatar
cards  
Mark Otto committed
198
199
200
201
<div class="card">
  <div class="card-header">
    Quote
  </div>
202
203
204
205
206
207
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
208
209
210
211
</div>
{% endexample %}

{% example html %}
212
<div class="card text-xs-center">
Mark Otto's avatar
cards  
Mark Otto committed
213
214
215
  <div class="card-header">
    Featured
  </div>
216
217
218
219
220
  <div class="card-block">
    <h4 class="card-title">Special title treatment</h4>
    <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
221
222
223
224
225
226
  <div class="card-footer text-muted">
    2 days ago
  </div>
</div>
{% endexample %}

227
## Header nav
228

229
Use Bootstrap's nav pills or tabs within a card header. Be sure to always include a `.pull-*-*` utility class for proper alignment.
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276

{% example html %}
<div class="card text-xs-center">
  <div class="card-header">
    <ul class="nav nav-tabs card-header-tabs pull-xs-left">
      <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>
  <div class="card-block">
    <h4 class="card-title">Special title treatment</h4>
    <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>
{% endexample %}

{% example html %}
<div class="card text-xs-center">
  <div class="card-header">
    <ul class="nav nav-pills card-header-pills pull-xs-left">
      <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>
  <div class="card-block">
    <h4 class="card-title">Special title treatment</h4>
    <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>
{% endexample %}

Mark Otto's avatar
Mark Otto committed
277
## Image caps
Mark Otto's avatar
cards  
Mark Otto committed
278
279
280
281
282

Similar to headers and footers, cards include top and bottom image caps.

{% example html %}
<div class="card">
XhmikosR's avatar
XhmikosR committed
283
  <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
284
285
286
287
288
  <div class="card-block">
    <h4 class="card-title">Card title</h4>
    <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
289
290
</div>
<div class="card">
291
292
293
294
295
  <div class="card-block">
    <h4 class="card-title">Card title</h4>
    <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
296
  <img class="card-img-bottom" data-src="holder.js/100px180/" alt="Card image cap">
Mark Otto's avatar
cards  
Mark Otto committed
297
298
299
</div>
{% endexample %}

Mark Otto's avatar
Mark Otto committed
300
## Image overlays
Mark Otto's avatar
cards  
Mark Otto committed
301

302
Turn an image into a card background and overlay your card's text. Depending on the image, you may or may not need `.card-inverse` (see below).
Mark Otto's avatar
cards  
Mark Otto committed
303
304
305

{% example html %}
<div class="card card-inverse">
XhmikosR's avatar
XhmikosR committed
306
  <img class="card-img" data-src="holder.js/100px270/#55595c:#373a3c/text:Card image" alt="Card image">
Mark Otto's avatar
cards  
Mark Otto committed
307
308
309
310
311
312
313
314
  <div class="card-img-overlay">
    <h4 class="card-title">Card title</h4>
    <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>
</div>
{% endexample %}

Mark Otto's avatar
Mark Otto committed
315
## Inverted text
Mark Otto's avatar
cards  
Mark Otto committed
316

317
318
Cards include a class for quickly toggling **the text color**. By default, cards use dark text and assume a light background. **Add `.card-inverse` for white text** and specify the `background-color` and `border-color` to go with it.

319
You can also use `.card-inverse` with the [contextual backgrounds variants](#background-variants).
Mark Otto's avatar
cards  
Mark Otto committed
320
321
322

{% example html %}
<div class="card card-inverse" style="background-color: #333; border-color: #333;">
323
324
325
  <div class="card-block">
    <h3 class="card-title">Special title treatment</h3>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
326
    <a href="#" class="btn btn-primary">Go somewhere</a>
327
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
328
329
330
</div>
{% endexample %}

Mark Otto's avatar
Mark Otto committed
331
## Background variants
Mark Otto's avatar
cards  
Mark Otto committed
332

333
Cards include their own variant classes for quickly changing the `background-color` and `border-color` of a card. **Darker colors require the use of `.card-inverse`.**
Mark Otto's avatar
cards  
Mark Otto committed
334
335

{% example html %}
336
<div class="card card-inverse card-primary text-xs-center">
337
338
339
340
341
342
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
343
</div>
344
<div class="card card-inverse card-success text-xs-center">
345
346
347
348
349
350
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
351
</div>
352
<div class="card card-inverse card-info text-xs-center">
353
354
355
356
357
358
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
359
</div>
360
<div class="card card-inverse card-warning text-xs-center">
361
362
363
364
365
366
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
367
</div>
368
<div class="card card-inverse card-danger text-xs-center">
petetnt's avatar
petetnt committed
369
370
371
372
373
374
375
376
377
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
</div>
{% endexample %}

378
379
380
{% capture callout-include %}{% include callout-warning-color-assistive-technologies.md %}{% endcapture %}
{{ callout-include | markdownify }}

petetnt's avatar
petetnt committed
381
382
## Outline variants

Mark Otto's avatar
Mark Otto committed
383
In need of a colored card, but not the hefty background colors they bring? Replace the default modifier classes with the `.card-outline-*` ones to style just the `border-color` of a card.
petetnt's avatar
petetnt committed
384
385

{% example html %}
Mark Otto's avatar
Mark Otto committed
386
<div class="card card-outline-primary text-xs-center">
petetnt's avatar
petetnt committed
387
388
389
390
391
392
393
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
</div>
Mark Otto's avatar
Mark Otto committed
394
<div class="card card-outline-secondary text-xs-center">
petetnt's avatar
petetnt committed
395
396
397
398
399
400
401
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
</div>
Mark Otto's avatar
Mark Otto committed
402
<div class="card card-outline-success text-xs-center">
petetnt's avatar
petetnt committed
403
404
405
406
407
408
409
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
</div>
Mark Otto's avatar
Mark Otto committed
410
<div class="card card-outline-info text-xs-center">
petetnt's avatar
petetnt committed
411
412
413
414
415
416
417
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
</div>
Mark Otto's avatar
Mark Otto committed
418
<div class="card card-outline-warning text-xs-center">
petetnt's avatar
petetnt committed
419
420
421
422
423
424
425
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
</div>
Mark Otto's avatar
Mark Otto committed
426
<div class="card card-outline-danger text-xs-center">
427
428
429
430
431
432
  <div class="card-block">
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
      <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
Mark Otto's avatar
cards  
Mark Otto committed
433
434
435
</div>
{% endexample %}

Mark Otto's avatar
Mark Otto committed
436
## Groups
Mark Otto's avatar
cards  
Mark Otto committed
437

Heinrich Fenkart's avatar
Heinrich Fenkart committed
438
Use card groups to render cards as a single, attached element with equal width and height columns. By default, card groups use `display: table;` and `table-layout: fixed;` to achieve their uniform sizing. However, enabling [flexbox mode]({{ site.baseurl }}/getting-started/flexbox) can switch that to use `display: flex;` and provide the same effect.
Mark Otto's avatar
cards  
Mark Otto committed
439

440
441
Only applies to small devices and above.

Mark Otto's avatar
cards  
Mark Otto committed
442
443
444
{% example html %}
<div class="card-group">
  <div class="card">
XhmikosR's avatar
XhmikosR committed
445
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
446
447
448
449
450
    <div class="card-block">
      <h4 class="card-title">Card title</h4>
      <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
451
452
  </div>
  <div class="card">
XhmikosR's avatar
XhmikosR committed
453
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
454
455
456
457
458
    <div class="card-block">
      <h4 class="card-title">Card title</h4>
      <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
459
460
  </div>
  <div class="card">
XhmikosR's avatar
XhmikosR committed
461
    <img class="card-img-top" data-src="holder.js/100px180/" alt="Card image cap">
462
463
464
465
466
    <div class="card-block">
      <h4 class="card-title">Card title</h4>
      <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
467
468
469
470
  </div>
</div>
{% endexample %}

471
## Decks
Mark Otto's avatar
cards  
Mark Otto committed
472

473
474
Need a set of equal width and height cards that aren't attached to one another? Use card decks. By default, card decks require two wrapping elements: `.card-deck-wrapper` and a `.card-deck`. We use table styles for the sizing and the gutters on `.card-deck`. The `.card-deck-wrapper` is used to negative margin out the `border-spacing` on the `.card-deck`.

475
476
Only applies to small devices and above.

Heinrich Fenkart's avatar
Heinrich Fenkart committed
477
**ProTip!** If you enable [flexbox mode]({{ site.baseurl }}/getting-started/flexbox/), you can remove the `.card-deck-wrapper`.
Mark Otto's avatar
cards  
Mark Otto committed
478
479

{% example html %}
480
481
<div class="card-deck-wrapper">
  <div class="card-deck">
Mark Otto's avatar
cards  
Mark Otto committed
482
    <div class="card">
XhmikosR's avatar
XhmikosR committed
483
      <img class="card-img-top" data-src="holder.js/100px200/" alt="Card image cap">
484
485
486
487
488
      <div class="card-block">
        <h4 class="card-title">Card title</h4>
        <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>
      </div>
Mark Otto's avatar
cards  
Mark Otto committed
489
490
    </div>
    <div class="card">
XhmikosR's avatar
XhmikosR committed
491
      <img class="card-img-top" data-src="holder.js/100px200/" alt="Card image cap">
492
493
494
495
496
      <div class="card-block">
        <h4 class="card-title">Card title</h4>
        <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
497
498
    </div>
    <div class="card">
XhmikosR's avatar
XhmikosR committed
499
      <img class="card-img-top" data-src="holder.js/100px200/" alt="Card image cap">
500
501
502
503
504
      <div class="card-block">
        <h4 class="card-title">Card title</h4>
        <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
505
506
507
508
509
    </div>
  </div>
</div>
{% endexample %}

Mark Otto's avatar
Mark Otto committed
510
## Columns
Mark Otto's avatar
cards  
Mark Otto committed
511

512
Cards can be organized into [Masonry](http://masonry.desandro.com)-like columns with just CSS by wrapping them in `.card-columns`. Cards are ordered from top to bottom and left to right when wrapped in `.card-columns`.
513
514

Only applies to small devices and above.
515

516
**Heads up!** This is **not available in IE9 and below** as they have no support for the [`column-*` CSS properties](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_multi-column_layouts).
Mark Otto's avatar
cards  
Mark Otto committed
517
518
519
520

{% example html %}
<div class="card-columns">
  <div class="card">
Mark Otto's avatar
Mark Otto committed
521
    <img class="card-img-top img-fluid" data-src="holder.js/100px160/" alt="Card image cap">
522
523
524
525
    <div class="card-block">
      <h4 class="card-title">Card title that wraps to a new line</h4>
      <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
526
  </div>
527
  <div class="card card-block">
Mark Otto's avatar
cards  
Mark Otto committed
528
529
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
530
531
532
533
534
      <footer>
        <small class="text-muted">
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
535
536
537
    </blockquote>
  </div>
  <div class="card">
Mark Otto's avatar
Mark Otto committed
538
    <img class="card-img-top img-fluid" data-src="holder.js/100px160/" alt="Card image cap">
539
540
541
542
543
    <div class="card-block">
      <h4 class="card-title">Card title</h4>
      <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
544
  </div>
545
  <div class="card card-block card-inverse card-primary text-xs-center">
Mark Otto's avatar
cards  
Mark Otto committed
546
    <blockquote class="card-blockquote">
547
548
549
550
551
552
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat.</p>
      <footer>
        <small>
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
553
554
    </blockquote>
  </div>
555
  <div class="card card-block text-xs-center">
Mark Otto's avatar
cards  
Mark Otto committed
556
557
558
559
    <h4 class="card-title">Card title</h4>
    <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>
560
  <div class="card">
Mark Otto's avatar
Mark Otto committed
561
    <img class="card-img img-fluid" data-src="holder.js/100px260/" alt="Card image">
562
  </div>
563
  <div class="card card-block text-xs-right">
Mark Otto's avatar
cards  
Mark Otto committed
564
565
    <blockquote class="card-blockquote">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
566
567
568
569
570
      <footer>
        <small class="text-muted">
          Someone famous in <cite title="Source Title">Source Title</cite>
        </small>
      </footer>
Mark Otto's avatar
cards  
Mark Otto committed
571
572
    </blockquote>
  </div>
573
  <div class="card card-block">
Mark Otto's avatar
cards  
Mark Otto committed
574
575
576
577
578
579
    <h4 class="card-title">Card title</h4>
    <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>
</div>
{% endexample %}
580
581
582
583
584
585
586
587
588
589
590
591
592

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