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…
- Open the folder titled
chapter8/start/app
, search the file namedrecipe08-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...