The card of the image doesn't line up exactly with the card next to it I've been trying to align two horizontal cards so that the bottom of the image lines up together. This is my current html code:
<div class="container"> <div class="row"> <div class="col"> <div class="card w-100 d-flex flex-column"> <div class="row"> <div class="col"> <div class="card-block"> <h3 class="header">More Equipment</h3> <hr> <p> This is some text and more text and also some more text </p> <a href="#" class="btn btn-danger btn-sm">Read More</a> </div> </div> <div class="col"> <img class="img-fluid w-100 h-100" src="images/airplane.jpeg" alt=""> </div> </div> </div> </div> <div class="col"> <div class="card w-100 d-flex flex-column"> <div class="row"> <div class="col"> <div class="card-block"> <h3 class="header">More Equipment</h3> <hr> <p> This is some text and more text and also some more text and more and more </p> <a href="#" class="btn btn-danger btn-sm">Read More</a> </div> </div> <div class="col"> <img class="img-fluid w-100 h-100" src="images/Agility.jpeg" alt=""> </div> </div> </div> </div>`
and my CSS code:
.card-block { font-size: 1.2em; position: relative; padding: 1em; border-top: 1px solid rgba(34, 36, 38, .1); box-shadow: none; } .card { font-size: 1em; overflow: hidden; padding: 5; border-radius: .27rem; box-shadow: 0 1px 3px 0 #d4d4d5, 0 0 1 1px #d4d4d5; margin-top: 25px; } .img { object-fit: cover; height: 100%; width: 100%; }
Posted the current image. My goal is to have the plane line up with the bottom of the second card image. I've been using Bootstrap version 4 for this purpose.
I have tried using this code:
<div class="container"> <div class="row"> <div class="col-sm-6 d-flex align-items-stretch"> <div class="card"> <div class="row"> <div class="col-sm-6 d-flex align-items-stretch"> <div class="card-block"> <h3 class="header">More Equipment</h3> <hr> <p> This is some text and more text and also some more text </p> <a href="#" class="btn btn-danger btn-sm">Read More</a> </div> </div> <div class="col-sm-6 d-flex align-items-stretch"> <img class="img-fluid d-flex w-100" src="images/airplane.jpeg" alt=""> </div> </div> </div> </div> <div class="col-sm-6 d-flex align-items-stretch"> <div class="card"> <div class="row"> <div class="col-sm-6 d-flex align-items-stretch"> <div class="card-block"> <h3 class="header">More Equipment</h3> <hr> <p> This is some text and more text and also some more text and more and more </p> <a href="#" class="btn btn-danger btn-sm">Read More</a> </div> </div> <div class="col-sm-6 d-flex align-items-stretch"> <img class="img-fluid d-flex w-100" src="images/Agility.jpeg" alt=""> </div> </div> </div> </div> </div> </div>
The bottom of the cards here are aligned well, but the image in the first card doesn't go all the way down to the bottom. Image: The plane is not aligned with the bottom of the second image
Adding h-100 to the div class row below the card class solved my problem.