Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
---
2
layout: docs
3
title: Cards
4
description: Bootstrap's cards provide a flexible and extensible content container with multiple variants and options.
5
group: components
6
toc: true
7
---
8
 
9
## About
10
 
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.
12
 
13
## Example
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]({{< docsref "/utilities/spacing" >}}) as needed.
16
 
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).
18
 
19
{{< example >}}
20
<div class="card" style="width: 18rem;">
21
  {{< placeholder width="100%" height="180" class="card-img-top" text="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>
27
</div>
28
{{< /example >}}
29
 
30
## Content types
31
 
32
Cards support a wide variety of content, including images, text, list groups, links, and more. Below are examples of what's supported.
33
 
34
### Body
35
 
36
The building block of a card is the `.card-body`. Use it whenever you need a padded section within a card.
37
 
38
{{< example >}}
39
<div class="card">
40
  <div class="card-body">
41
    This is some text within a card body.
42
  </div>
43
</div>
44
{{< /example >}}
45
 
46
### Titles, text, and links
47
 
48
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.
49
 
50
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.
51
 
52
{{< example >}}
53
<div class="card" style="width: 18rem;">
54
  <div class="card-body">
55
    <h5 class="card-title">Card title</h5>
56
    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
57
    <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>
58
    <a href="#" class="card-link">Card link</a>
59
    <a href="#" class="card-link">Another link</a>
60
  </div>
61
</div>
62
{{< /example >}}
63
 
64
### Images
65
 
66
`.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.
67
 
68
{{< example >}}
69
<div class="card" style="width: 18rem;">
70
  {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
71
  <div class="card-body">
72
    <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>
73
  </div>
74
</div>
75
{{< /example >}}
76
 
77
### List groups
78
 
79
Create lists of content in a card with a flush list group.
80
 
81
{{< example >}}
82
<div class="card" style="width: 18rem;">
83
  <ul class="list-group list-group-flush">
84
    <li class="list-group-item">An item</li>
85
    <li class="list-group-item">A second item</li>
86
    <li class="list-group-item">A third item</li>
87
  </ul>
88
</div>
89
{{< /example >}}
90
 
91
{{< example >}}
92
<div class="card" style="width: 18rem;">
93
  <div class="card-header">
94
    Featured
95
  </div>
96
  <ul class="list-group list-group-flush">
97
    <li class="list-group-item">An item</li>
98
    <li class="list-group-item">A second item</li>
99
    <li class="list-group-item">A third item</li>
100
  </ul>
101
</div>
102
{{< /example >}}
103
 
104
{{< example >}}
105
<div class="card" style="width: 18rem;">
106
  <ul class="list-group list-group-flush">
107
    <li class="list-group-item">An item</li>
108
    <li class="list-group-item">A second item</li>
109
    <li class="list-group-item">A third item</li>
110
  </ul>
111
  <div class="card-footer">
112
    Card footer
113
  </div>
114
</div>
115
{{< /example >}}
116
 
117
### Kitchen sink
118
 
119
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.
120
 
121
{{< example >}}
122
<div class="card" style="width: 18rem;">
123
  {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
124
  <div class="card-body">
125
    <h5 class="card-title">Card title</h5>
126
    <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>
127
  </div>
128
  <ul class="list-group list-group-flush">
129
    <li class="list-group-item">An item</li>
130
    <li class="list-group-item">A second item</li>
131
    <li class="list-group-item">A third item</li>
132
  </ul>
133
  <div class="card-body">
134
    <a href="#" class="card-link">Card link</a>
135
    <a href="#" class="card-link">Another link</a>
136
  </div>
137
</div>
138
{{< /example >}}
139
 
140
### Header and footer
141
 
142
Add an optional header and/or footer within a card.
143
 
144
{{< example >}}
145
<div class="card">
146
  <div class="card-header">
147
    Featured
148
  </div>
149
  <div class="card-body">
150
    <h5 class="card-title">Special title treatment</h5>
151
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
152
    <a href="#" class="btn btn-primary">Go somewhere</a>
153
  </div>
154
</div>
155
{{< /example >}}
156
 
157
Card headers can be styled by adding `.card-header` to `<h*>` elements.
158
 
159
{{< example >}}
160
<div class="card">
161
  <h5 class="card-header">Featured</h5>
162
  <div class="card-body">
163
    <h5 class="card-title">Special title treatment</h5>
164
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
165
    <a href="#" class="btn btn-primary">Go somewhere</a>
166
  </div>
167
</div>
168
{{< /example >}}
169
 
170
{{< example >}}
171
<div class="card">
172
  <div class="card-header">
173
    Quote
174
  </div>
175
  <div class="card-body">
176
    <blockquote class="blockquote mb-0">
177
      <p>A well-known quote, contained in a blockquote element.</p>
178
      <footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
179
    </blockquote>
180
  </div>
181
</div>
182
{{< /example >}}
183
 
184
{{< example >}}
185
<div class="card text-center">
186
  <div class="card-header">
187
    Featured
188
  </div>
189
  <div class="card-body">
190
    <h5 class="card-title">Special title treatment</h5>
191
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
192
    <a href="#" class="btn btn-primary">Go somewhere</a>
193
  </div>
194
  <div class="card-footer text-muted">
195
    2 days ago
196
  </div>
197
</div>
198
{{< /example >}}
199
 
200
## Sizing
201
 
202
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.
203
 
204
### Using grid markup
205
 
206
Using the grid, wrap cards in columns and rows as needed.
207
 
208
{{< example >}}
209
<div class="row">
210
  <div class="col-sm-6">
211
    <div class="card">
212
      <div class="card-body">
213
        <h5 class="card-title">Special title treatment</h5>
214
        <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
215
        <a href="#" class="btn btn-primary">Go somewhere</a>
216
      </div>
217
    </div>
218
  </div>
219
  <div class="col-sm-6">
220
    <div class="card">
221
      <div class="card-body">
222
        <h5 class="card-title">Special title treatment</h5>
223
        <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
224
        <a href="#" class="btn btn-primary">Go somewhere</a>
225
      </div>
226
    </div>
227
  </div>
228
</div>
229
{{< /example >}}
230
 
231
### Using utilities
232
 
233
Use our handful of [available sizing utilities]({{< docsref "/utilities/sizing" >}}) to quickly set a card's width.
234
 
235
{{< example >}}
236
<div class="card w-75">
237
  <div class="card-body">
238
    <h5 class="card-title">Card title</h5>
239
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
240
    <a href="#" class="btn btn-primary">Button</a>
241
  </div>
242
</div>
243
 
244
<div class="card w-50">
245
  <div class="card-body">
246
    <h5 class="card-title">Card title</h5>
247
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
248
    <a href="#" class="btn btn-primary">Button</a>
249
  </div>
250
</div>
251
{{< /example >}}
252
 
253
### Using custom CSS
254
 
255
Use custom CSS in your stylesheets or as inline styles to set a width.
256
 
257
{{< example >}}
258
<div class="card" style="width: 18rem;">
259
  <div class="card-body">
260
    <h5 class="card-title">Special title treatment</h5>
261
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
262
    <a href="#" class="btn btn-primary">Go somewhere</a>
263
  </div>
264
</div>
265
{{< /example >}}
266
 
267
## Text alignment
268
 
269
You can quickly change the text alignment of any card—in its entirety or specific parts—with our [text align classes]({{< docsref "/utilities/text#text-alignment" >}}).
270
 
271
{{< example >}}
272
<div class="card" style="width: 18rem;">
273
  <div class="card-body">
274
    <h5 class="card-title">Special title treatment</h5>
275
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
276
    <a href="#" class="btn btn-primary">Go somewhere</a>
277
  </div>
278
</div>
279
 
280
<div class="card text-center" style="width: 18rem;">
281
  <div class="card-body">
282
    <h5 class="card-title">Special title treatment</h5>
283
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
284
    <a href="#" class="btn btn-primary">Go somewhere</a>
285
  </div>
286
</div>
287
 
288
<div class="card text-right" style="width: 18rem;">
289
  <div class="card-body">
290
    <h5 class="card-title">Special title treatment</h5>
291
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
292
    <a href="#" class="btn btn-primary">Go somewhere</a>
293
  </div>
294
</div>
295
{{< /example >}}
296
 
297
## Navigation
298
 
299
Add some navigation to a card's header (or block) with Bootstrap's [nav components]({{< docsref "/components/navs" >}}).
300
 
301
{{< example >}}
302
<div class="card text-center">
303
  <div class="card-header">
304
    <ul class="nav nav-tabs card-header-tabs">
305
      <li class="nav-item">
306
        <a class="nav-link active" href="#">Active</a>
307
      </li>
308
      <li class="nav-item">
309
        <a class="nav-link" href="#">Link</a>
310
      </li>
311
      <li class="nav-item">
312
        <a class="nav-link disabled">Disabled</a>
313
      </li>
314
    </ul>
315
  </div>
316
  <div class="card-body">
317
    <h5 class="card-title">Special title treatment</h5>
318
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
319
    <a href="#" class="btn btn-primary">Go somewhere</a>
320
  </div>
321
</div>
322
{{< /example >}}
323
 
324
{{< example >}}
325
<div class="card text-center">
326
  <div class="card-header">
327
    <ul class="nav nav-pills card-header-pills">
328
      <li class="nav-item">
329
        <a class="nav-link active" href="#">Active</a>
330
      </li>
331
      <li class="nav-item">
332
        <a class="nav-link" href="#">Link</a>
333
      </li>
334
      <li class="nav-item">
335
        <a class="nav-link disabled">Disabled</a>
336
      </li>
337
    </ul>
338
  </div>
339
  <div class="card-body">
340
    <h5 class="card-title">Special title treatment</h5>
341
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
342
    <a href="#" class="btn btn-primary">Go somewhere</a>
343
  </div>
344
</div>
345
{{< /example >}}
346
 
347
## Images
348
 
349
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.
350
 
351
### Image caps
352
 
353
Similar to headers and footers, cards can include top and bottom "image caps"—images at the top or bottom of a card.
354
 
355
{{< example >}}
356
<div class="card mb-3">
357
  {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
358
  <div class="card-body">
359
    <h5 class="card-title">Card title</h5>
360
    <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>
361
    <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
362
  </div>
363
</div>
364
<div class="card">
365
  <div class="card-body">
366
    <h5 class="card-title">Card title</h5>
367
    <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>
368
    <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
369
  </div>
370
  {{< placeholder width="100%" height="180" class="card-img-bottom" text="Image cap" >}}
371
</div>
372
{{< /example >}}
373
 
374
### Image overlays
375
 
376
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.
377
 
378
{{< example >}}
379
<div class="card bg-dark text-white">
380
  {{< placeholder width="100%" height="270" class="bd-placeholder-img-lg card-img" text="Card image" >}}
381
  <div class="card-img-overlay">
382
    <h5 class="card-title">Card title</h5>
383
    <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>
384
    <p class="card-text">Last updated 3 mins ago</p>
385
  </div>
386
</div>
387
{{< /example >}}
388
 
389
{{< callout info >}}
390
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.
391
{{< /callout >}}
392
 
393
## Horizontal
394
 
395
Using a combination of grid and utility classes, cards can be made horizontal in a mobile-friendly and responsive way. In the example below, we remove the grid gutters with `.no-gutters` and use `.col-md-*` classes to make the card horizontal at the `md` breakpoint. Further adjustments may be needed depending on your card content.
396
 
397
{{< example >}}
398
<div class="card mb-3" style="max-width: 540px;">
399
  <div class="row no-gutters">
400
    <div class="col-md-4">
401
      {{< placeholder width="100%" height="250" class="" text="Image" >}}
402
    </div>
403
    <div class="col-md-8">
404
      <div class="card-body">
405
        <h5 class="card-title">Card title</h5>
406
        <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>
407
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
408
      </div>
409
    </div>
410
  </div>
411
</div>
412
{{< /example >}}
413
 
414
## Card styles
415
 
416
Cards include various options for customizing their backgrounds, borders, and color.
417
 
418
### Background and color
419
 
420
Use [text and background utilities]({{< docsref "/utilities/colors" >}}) to change the appearance of a card.
421
 
422
{{< example >}}
423
{{< card.inline >}}
424
{{- range (index $.Site.Data "theme-colors") }}
425
<div class="card{{ if not (eq .name "light") }} text-white{{ end }} bg-{{ .name }} mb-3" style="max-width: 18rem;">
426
  <div class="card-header">Header</div>
427
  <div class="card-body">
428
    <h5 class="card-title">{{ .name | title }} card title</h5>
429
    <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>
430
  </div>
431
</div>
432
{{- end -}}
433
{{< /card.inline >}}
434
{{< /example >}}
435
 
436
{{< callout warning >}}
437
{{< partial "callout-warning-color-assistive-technologies.md" >}}
438
{{< /callout >}}
439
 
440
### Border
441
 
442
Use [border utilities]({{< docsref "/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.
443
 
444
{{< example >}}
445
{{< card.inline >}}
446
{{- range (index $.Site.Data "theme-colors") }}
447
<div class="card border-{{ .name }} mb-3" style="max-width: 18rem;">
448
  <div class="card-header">Header</div>
449
  <div class="card-body{{ if not (eq .name "light") }} text-{{ .name }}{{ end }}">
450
    <h5 class="card-title">{{ .name | title }} card title</h5>
451
    <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>
452
  </div>
453
</div>
454
{{- end -}}
455
{{< /card.inline >}}
456
{{< /example >}}
457
 
458
### Mixins utilities
459
 
460
You can also change the borders on the card header and footer as needed, and even remove their `background-color` with `.bg-transparent`.
461
 
462
{{< example >}}
463
<div class="card border-success mb-3" style="max-width: 18rem;">
464
  <div class="card-header bg-transparent border-success">Header</div>
465
  <div class="card-body text-success">
466
    <h5 class="card-title">Success card title</h5>
467
    <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>
468
  </div>
469
  <div class="card-footer bg-transparent border-success">Footer</div>
470
</div>
471
{{< /example >}}
472
 
473
## Card layout
474
 
475
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**.
476
 
477
### Card groups
478
 
479
Use card groups to render cards as a single, attached element with equal width and height columns. Card groups start off stacked and use `display: flex;` to become attached with uniform dimensions starting at the `sm` breakpoint.
480
 
481
{{< example >}}
482
<div class="card-group">
483
  <div class="card">
484
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
485
    <div class="card-body">
486
      <h5 class="card-title">Card title</h5>
487
      <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>
488
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
489
    </div>
490
  </div>
491
  <div class="card">
492
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
493
    <div class="card-body">
494
      <h5 class="card-title">Card title</h5>
495
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
496
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
497
    </div>
498
  </div>
499
  <div class="card">
500
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
501
    <div class="card-body">
502
      <h5 class="card-title">Card title</h5>
503
      <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>
504
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
505
    </div>
506
  </div>
507
</div>
508
{{< /example >}}
509
 
510
When using card groups with footers, their content will automatically line up.
511
 
512
{{< example >}}
513
<div class="card-group">
514
  <div class="card">
515
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
516
    <div class="card-body">
517
      <h5 class="card-title">Card title</h5>
518
      <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>
519
    </div>
520
    <div class="card-footer">
521
      <small class="text-muted">Last updated 3 mins ago</small>
522
    </div>
523
  </div>
524
  <div class="card">
525
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
526
    <div class="card-body">
527
      <h5 class="card-title">Card title</h5>
528
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
529
    </div>
530
    <div class="card-footer">
531
      <small class="text-muted">Last updated 3 mins ago</small>
532
    </div>
533
  </div>
534
  <div class="card">
535
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
536
    <div class="card-body">
537
      <h5 class="card-title">Card title</h5>
538
      <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>
539
    </div>
540
    <div class="card-footer">
541
      <small class="text-muted">Last updated 3 mins ago</small>
542
    </div>
543
  </div>
544
</div>
545
{{< /example >}}
546
 
547
### Card decks
548
 
549
Need a set of equal width and height cards that aren't attached to one another? Use card decks.
550
 
551
{{< example >}}
552
<div class="card-deck">
553
  <div class="card">
554
    {{< placeholder width="100%" height="200" class="card-img-top" text="Image cap" >}}
555
    <div class="card-body">
556
      <h5 class="card-title">Card title</h5>
557
      <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>
558
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
559
    </div>
560
  </div>
561
  <div class="card">
562
    {{< placeholder width="100%" height="200" class="card-img-top" text="Image cap" >}}
563
    <div class="card-body">
564
      <h5 class="card-title">Card title</h5>
565
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
566
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
567
    </div>
568
  </div>
569
  <div class="card">
570
    {{< placeholder width="100%" height="200" class="card-img-top" text="Image cap" >}}
571
    <div class="card-body">
572
      <h5 class="card-title">Card title</h5>
573
      <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>
574
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
575
    </div>
576
  </div>
577
</div>
578
{{< /example >}}
579
 
580
Just like with card groups, card footers in decks will automatically line up.
581
 
582
{{< example >}}
583
<div class="card-deck">
584
  <div class="card">
585
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
586
    <div class="card-body">
587
      <h5 class="card-title">Card title</h5>
588
      <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>
589
    </div>
590
    <div class="card-footer">
591
      <small class="text-muted">Last updated 3 mins ago</small>
592
    </div>
593
  </div>
594
  <div class="card">
595
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
596
    <div class="card-body">
597
      <h5 class="card-title">Card title</h5>
598
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
599
    </div>
600
    <div class="card-footer">
601
      <small class="text-muted">Last updated 3 mins ago</small>
602
    </div>
603
  </div>
604
  <div class="card">
605
    {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
606
    <div class="card-body">
607
      <h5 class="card-title">Card title</h5>
608
      <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>
609
    </div>
610
    <div class="card-footer">
611
      <small class="text-muted">Last updated 3 mins ago</small>
612
    </div>
613
  </div>
614
</div>
615
{{< /example >}}
616
 
617
### Grid cards
618
 
619
Use the Bootstrap grid system and its [`.row-cols` classes]({{< docsref "/layout/grid#row-columns" >}}) to control how many grid columns (wrapped around your cards) you show per row. For example, here's `.row-cols-1` laying out the cards on one column, and `.row-cols-md-2` splitting four cards to equal width across multiple rows, from the medium breakpoint up.
620
 
621
{{< example >}}
622
<div class="row row-cols-1 row-cols-md-2">
623
  <div class="col mb-4">
624
    <div class="card">
625
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
626
      <div class="card-body">
627
        <h5 class="card-title">Card title</h5>
628
        <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>
629
      </div>
630
    </div>
631
  </div>
632
  <div class="col mb-4">
633
    <div class="card">
634
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
635
      <div class="card-body">
636
        <h5 class="card-title">Card title</h5>
637
        <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>
638
      </div>
639
    </div>
640
  </div>
641
  <div class="col mb-4">
642
    <div class="card">
643
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
644
      <div class="card-body">
645
        <h5 class="card-title">Card title</h5>
646
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
647
      </div>
648
    </div>
649
  </div>
650
  <div class="col mb-4">
651
    <div class="card">
652
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
653
      <div class="card-body">
654
        <h5 class="card-title">Card title</h5>
655
        <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>
656
      </div>
657
    </div>
658
  </div>
659
</div>
660
{{< /example >}}
661
 
662
Change it to `.row-cols-3` and you'll see the fourth card wrap.
663
 
664
{{< example >}}
665
<div class="row row-cols-1 row-cols-md-3">
666
  <div class="col mb-4">
667
    <div class="card">
668
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
669
      <div class="card-body">
670
        <h5 class="card-title">Card title</h5>
671
        <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>
672
      </div>
673
    </div>
674
  </div>
675
  <div class="col mb-4">
676
    <div class="card">
677
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
678
      <div class="card-body">
679
        <h5 class="card-title">Card title</h5>
680
        <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>
681
      </div>
682
    </div>
683
  </div>
684
  <div class="col mb-4">
685
    <div class="card">
686
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
687
      <div class="card-body">
688
        <h5 class="card-title">Card title</h5>
689
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
690
      </div>
691
    </div>
692
  </div>
693
  <div class="col mb-4">
694
    <div class="card">
695
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
696
      <div class="card-body">
697
        <h5 class="card-title">Card title</h5>
698
        <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>
699
      </div>
700
    </div>
701
  </div>
702
</div>
703
{{< /example >}}
704
 
705
When you need equal height, add `.h-100` to the cards. If you want equal heights by default, you can set `$card-height: 100%` in Sass.
706
 
707
{{< example >}}
708
<div class="row row-cols-1 row-cols-md-3">
709
  <div class="col mb-4">
710
    <div class="card h-100">
711
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
712
      <div class="card-body">
713
        <h5 class="card-title">Card title</h5>
714
        <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>
715
      </div>
716
    </div>
717
  </div>
718
  <div class="col mb-4">
719
    <div class="card h-100">
720
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
721
      <div class="card-body">
722
        <h5 class="card-title">Card title</h5>
723
        <p class="card-text">This is a short card.</p>
724
      </div>
725
    </div>
726
  </div>
727
  <div class="col mb-4">
728
    <div class="card h-100">
729
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
730
      <div class="card-body">
731
        <h5 class="card-title">Card title</h5>
732
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
733
      </div>
734
    </div>
735
  </div>
736
  <div class="col mb-4">
737
    <div class="card h-100">
738
      {{< placeholder width="100%" height="180" class="card-img-top" text="Image cap" >}}
739
      <div class="card-body">
740
        <h5 class="card-title">Card title</h5>
741
        <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>
742
      </div>
743
    </div>
744
  </div>
745
</div>
746
{{< /example >}}
747
 
748
### Card columns
749
 
750
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.
751
 
752
**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.
753
 
754
{{< example >}}
755
<div class="card-columns">
756
  <div class="card">
757
    {{< placeholder width="100%" height="160" class="card-img-top" text="Image cap" >}}
758
    <div class="card-body">
759
      <h5 class="card-title">Card title that wraps to a new line</h5>
760
      <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>
761
    </div>
762
  </div>
763
  <div class="card p-3">
764
    <blockquote class="blockquote mb-0 card-body">
765
      <p>A well-known quote, contained in a blockquote element.</p>
766
      <footer class="blockquote-footer">
767
        <small class="text-muted">
768
          Someone famous in <cite title="Source Title">Source Title</cite>
769
        </small>
770
      </footer>
771
    </blockquote>
772
  </div>
773
  <div class="card">
774
    {{< placeholder width="100%" height="160" class="card-img-top" text="Image cap" >}}
775
    <div class="card-body">
776
      <h5 class="card-title">Card title</h5>
777
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
778
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
779
    </div>
780
  </div>
781
  <div class="card bg-primary text-white text-center p-3">
782
    <blockquote class="blockquote mb-0">
783
      <p>A well-known quote, contained in a blockquote element.</p>
784
      <footer class="blockquote-footer text-white">
785
        <small>
786
          Someone famous in <cite title="Source Title">Source Title</cite>
787
        </small>
788
      </footer>
789
    </blockquote>
790
  </div>
791
  <div class="card text-center">
792
    <div class="card-body">
793
      <h5 class="card-title">Card title</h5>
794
      <p class="card-text">This card has a regular title and short paragraphy of text below it.</p>
795
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
796
    </div>
797
  </div>
798
  <div class="card">
799
    {{< placeholder width="100%" height="260" class="card-img" text="Card image" >}}
800
  </div>
801
  <div class="card p-3 text-right">
802
    <blockquote class="blockquote mb-0">
803
      <p>A well-known quote, contained in a blockquote element.</p>
804
      <footer class="blockquote-footer">
805
        <small class="text-muted">
806
          Someone famous in <cite title="Source Title">Source Title</cite>
807
        </small>
808
      </footer>
809
    </blockquote>
810
  </div>
811
  <div class="card">
812
    <div class="card-body">
813
      <h5 class="card-title">Card title</h5>
814
      <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>
815
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
816
    </div>
817
  </div>
818
</div>
819
{{< /example >}}
820
 
821
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.
822
 
823
```scss
824
.card-columns {
825
  @include media-breakpoint-only(lg) {
826
    column-count: 4;
827
  }
828
  @include media-breakpoint-only(xl) {
829
    column-count: 5;
830
  }
831
}
832
```