I am attempting to center a card-columns horizontally using Bootstrap 4.3.1 while nesting cards.
Below is the structure of my nested cards:
> Main Card
>> Card-columns
>>> Card 1
>>> Card 2
>>> Card 3
>>> Card N
I attempted to apply the mx-auto
class to both the main-card and the card-columns, but it did not center the card-columns on the page.
Here is the code snippet:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<main role="main">
<div class="container-fluid">
<div class="mx-auto card bg-light">
<div class="card-body">
<h2 class="card-title text-center text-uppercase text-info">Cards</h2>
<hr />
<div class="card-columns mx-auto">
<div class="card text-center">
<div class="card-body">
<h5 class="card-title">Card 1</h5>
<p class="card-text">This card has a regular title and short paragraph of text below it.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card text-center">
<div class="card-body">
<h5 class="card-title">Card 2</h5>
<p class="card-text">This card has a regular title and short paragraph of text below it.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
I have also created a fiddler to showcase what I've tried so far.
How can I properly center the card-column content on the screen?