Reader small image

You're reading from  Bootstrap 4 Cookbook

Product typeBook
Published inJun 2017
Reading LevelBeginner
PublisherPackt
ISBN-139781785889295
Edition1st Edition
Languages
Right arrow
Author (1)
Ajdin Imsirovic
Ajdin Imsirovic
author image
Ajdin Imsirovic

Ajdin Imsirovic is a full-stack web developer who has published several courses on the subject of web design and web development. He has also authored three books, Bootstrap 4 Cookbook, Elm Web Development, and Vue.js Quick Start Guide. In his fourth book, Vue CLI 3 Quick Start Guide, he introduces readers to the rich ecosystem of frontend tooling and best practices.
Read more about Ajdin Imsirovic

Right arrow

Center-aligning cards on wider viewports only


In this recipe, we will look at how we can center align cards' content. We will have varying amounts of content in cards inside the same row. We will see how easy it is to align this content with the use of Flexbox.

Getting ready

To get ready for this recipe, we will first preview the end result that we are trying to achieve. In your console, locate the chapter8/complete/app folder run the harp server command on it. Preview the completed recipe by visiting localhost:9000/recipe08-06 in your browser.

How to do it…

  1. Open the folder titled chapter8/start/app, search the file named recipe08-06.ejs and paste in the following code:
<div class="container">
 <h2 class="mt-5 pb-3">Recipe 08-06: Center-Aligning Cards on Wider Viewports Only</h2>
 <p class="mt-4">In this recipe we will look at centering the card content with flexbox.</p>
</div>
<!-- /.container -->
<style>
 .col {
 min-width: 280px;
 }
 .card img...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Bootstrap 4 Cookbook
Published in: Jun 2017Publisher: PacktISBN-13: 9781785889295

Author (1)

author image
Ajdin Imsirovic

Ajdin Imsirovic is a full-stack web developer who has published several courses on the subject of web design and web development. He has also authored three books, Bootstrap 4 Cookbook, Elm Web Development, and Vue.js Quick Start Guide. In his fourth book, Vue CLI 3 Quick Start Guide, he introduces readers to the rich ecosystem of frontend tooling and best practices.
Read more about Ajdin Imsirovic