Topic: Card with Equal Height Layout??

.jodadev. pro asked 6 years ago


I'm trying to have all my cards with the same height. I followed this example and while the height is the same, the space is incorrect. For example, in the third card (or smallest card) I want the left-over space to be AFTER the text, just like it is in the example. However, after i write the code, the space appears after the photo and before the text, looking pretty bad. Any help would be appreciated, thanks!
<!-- Container -->
<div class="row">

    <!-- Column -->
    <div class="col-md-4 mb-4 d-flex align-items-stretch">

        <!--Card-->
        <div class="card">

            <!--Card image-->
            <div class="view">
                <img src="https://mdbootstrap.com/img/Photos/Horizontal/Nature/6-col/img%20(132).jpg" class="img-fluid" alt="">
                <a href="#">
                    <div class="mask rgba-white-slight"></div>
                </a>
            </div>

            <!--Card content-->
            <div class="card-body">
                <!--Title-->
                <h4 class="card-title">Card title</h4>
                <!--Text-->
                <p class="card-text">At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.</p>
            </div>

        </div>
        <!--/.Card-->

    </div>
    <!-- Column -->

    <!-- Column -->
    <div class="col-md-4 mb-4 d-flex align-items-stretch">

        <!--Card-->
        <div class="card">

            <!--Card content-->
            <div class="card-body">
                <!--Title-->
                <h4 class="card-title">Card title</h4>
                <!--Text-->
                <p class="card-text">Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
                <p class="card-text">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.</p>
            </div>

        </div>
        <!--/.Card-->

    </div>
    <!-- Column -->

    <!-- Column -->
    <div class="col-md-4 mb-4 d-flex align-items-stretch">

        <!--Card-->
        <div class="card">

            <!--Card image-->
            <div class="view">
                <img src="https://mdbootstrap.com/img/Photos/Horizontal/Nature/6-col/img%20(133).jpg" class="img-fluid" alt="">
                <a href="#">
                    <div class="mask rgba-white-slight"></div>
                </a>
            </div>

            <!--Card content-->
            <div class="card-body">
                <!--Title-->
                <h4 class="card-title">Card title</h4>
                <!--Text-->
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
            </div>

        </div>
        <!--/.Card-->
        
    </div>
    <!-- Column -->

</div>
<!-- Container -->

Marta Wierzbicka staff answered 6 years ago


Hi,

is Ollie's answer fine for you?

Best,

Marta


Ollie Vincent pro answered 6 years ago


Hi, I found a useful piece of JavaScript that can do this. Use this link (I saved it) https://docs.google.com/document/d/1DHTM9t47YjivqsLcC1XQT6F3onwyP2fwph6nU54c0No/edit?usp=sharing Copy the <script> tags into your footer, and wrap your <div> around your element. .js-equal-height is used in my code, but any div will work :) See what you think...

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags