How do I create a responsive card deck or card grid in Bootstrap 5?
Asked on Jun 01, 2025
1 Answer
To create a responsive card deck or card grid in Bootstrap 5, you can use the grid system with the `row` and `col` classes. Here's a simple example:
<!-- BEGIN COPY / PASTE -->
<div class="container">
<div class="row row-cols-1 row-cols-md-3 g-4">
<div class="col">
<div class="card">
<img src="..." class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<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>
</div>
</div>
<div class="col">
<div class="card">
<img src="..." class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<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>
</div>
</div>
<div class="col">
<div class="card">
<img src="..." class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<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>
</div>
</div>
</div>
</div>
<!-- END COPY / PASTE -->
Additional Comment:
✅ Answered with Bootstrap 5 best practices.- The `row-cols-1 row-cols-md-3` classes create a responsive grid with one column on small screens and three columns on medium and larger screens.
- The `g-4` class adds a gutter between the columns.
- Replace the `src="..."` in the `
` tag with your image source URL.
- You can adjust the number of columns by changing the `row-cols-*` classes as needed.