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

resizing and rounded image on a bootstrap-5 card

I want to resize and rounded the image in a bootstrap-5 card but i don’t know how to do that using bootstrap-5 or css3, I want the image to be smaller and rounded on a center of this card.

My Template:

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
    rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
    crossorigin="anonymous">
    
    

<div class="container">
        <div class="row justify-content-center">
            <div class="col">
                <div class="card text-center">
                    <img class="rounded" src="https://3.imimg.com/data3/LE/LH/GLADMIN-37134/school-badges-500x500.jpg" alt="">
                    <h1 class="text-primary">{{board.school_name}}</h1>
                    <p>{{board.school_address}}, {{board.location}}</p>
                    <p>P O Box: {{board.p_o_box}}</p>
                </div>
            </div>
        </div>
    </div>

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

>Solution :

your image is a bad choice as it has a white border around the actual graphic. but see here. i added a .thumb class with a width/height. a align-items-center on the .row and a .rounded-circle on the image.

.thumb {
  width: 100px;
  height: auto; // if the image is square, this will be 100px automatically
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
    rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
    crossorigin="anonymous">
    
    

<div class="container">
        <div class="row justify-content-center">
            <div class="col">
                <div class="card align-items-center">
                    <img class="rounded-circle thumb" src="https://dummyimage.com/300x300/000/fff.jpg" alt="ff">
                    <h1 class="text-primary">{{board.school_name}}</h1>
                    <p>{{board.school_address}}, {{board.location}}</p>
                    <p>P O Box: {{board.p_o_box}}</p>
                </div>
            </div>
        </div>
    </div>
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