How to keep images for same height and width inside bootstrap 4.4.1 cards?

Questions and tutorials related to Cascading Style Sheets *all versions*

Moderators: egami, macek, gesf

Post Reply
prohor
New php-forum User
New php-forum User
Posts: 17
Joined: Sun Sep 11, 2016 8:38 am

Fri May 21, 2021 6:28 am

I am trying to use bootstrap cards with images inside. I need to keep all the cards to be in same size (same width and height). Images should also be the same height and width as well. I have tried several solutions found on net but not work in my case including “width” and “height” attribute in tag. Any solution would be a great help! Here is my code for cards

Code: Select all

    <div class="col mt-4">

                    <div class="card">
                     
                        <a href="product-details.php?pid=<?php echo htmlentities($row['id']);?>">
                            <img  src="admin/productimages/<?php echo htmlentities($row['id']);?>/<?php echo htmlentities($row['productImage1']);?>" data-echo="admin/productimages/<?php echo htmlentities($row['id']);?>/<?php echo htmlentities($row['productImage1']);?>"   alt="" width="340" height="440"></a>
                    </div>
                </div>

User avatar
hyper
php-forum GURU
php-forum GURU
Posts: 1215
Joined: Mon Feb 22, 2016 5:52 pm

Sun May 23, 2021 3:50 am

Look at your output html (view source) and check that it is correct.

If it is correct, view the page in developer tools to see where it's going wrong.
Post Reply