I am using bootstrap 4 alpha 3.
I want to center the card horizontally in the middle across the page.
Preview / link:
http://codepen.io/vaibhavsingh97/full/VjRAXW
I have tried all the different options listed on the bootstrap 4 example page for cards.
How can I achieve this?
What you need to know, d-flex -> makes the element a flexbox. align-items-center - vertically aligns the content. justify-content-center - horizontally aligns the content.
<img src="image_source" class="mx-auto d-block" ...>
Add the css for .card
.card { margin: 0 auto; /* Added */ float: none; /* Added */ margin-bottom: 10px; /* Added */ }
here is the pen
UPDATE: You can use the class .mx-auto
available in bootstrap 4 to center cards.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With