Skip to main content

Bootstrap 5 cards equal height

  • Bootstrap 5 cards equal height using d-flex

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm d-flex">
                <div class="card card-body flex-fill">
                    A small card content.
                </div>
            </div>
            <div class="col-sm d-flex">
                <div class="card card-body flex-fill">
                    "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
                    in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
                </div>
            </div>
            <div class="col-sm d-flex">
                <div class="card card-body flex-fill">
                    Another small card content.
                </div>
            </div>
        </div>
    </div>

    We have to use the d-flex property to assign equal height to each card in bootstrap. Sometimes we have to create cards with text, images, and links and each card does not have the same amount of content. In that case, we have to create cards with equal height. 

  • Back to code snippet queries related bootstrap