Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to make responsive images in bootstrap 5

There are some cards in my website that they are fine in the large and medium screens , But in the small screens the image’s height will be increase !

I’m using bootstrap 5 and there is the code :

                        <div class="col-12 mb-4">
                        <div class="card m-auto w-100 h-100 rounded">
                            <div class="row g-0">
                                <div class="col-4 h-100">
                                    <img src="{{ i.image.url }}" class="img-fluid rounded h-100" alt="...">
                                </div>
                                <div class="col-8">
                                    <div class="card-body">
                                        <p class="weblog-post-title card-title" style="font-size: 1.25rem;">{{ i.title }}</p>
                                        <p class="weblog-summery card-text text-muted">{{ post.summery|truncatechars:70 }}</p>
                                        <div class="row mt-2">
                                            <div class="col-6">
                                                <p class="card-text"><small class="text-muted">{{ i.create|date:"SHORT_DATE_FORMAT" }}</small>
                                                </p>
                                            </div>
                                            <div class="col-6 text-start">
                                                <a href="{{ i.get_absolute_url }}"
                                                    class="btn btn-green btn-sm mt-2" style="border-radius: 10px;">see</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

there is the picture of large screens :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

here the card is fine

there is the picture of small screens:

there is the problem with the image

>Solution :

you can use Media Queries (sm:, md:, lg:, xl:, xxl:) to make the images responsive

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading