Home > front end >  resizing and rounded image on a bootstrap-5 card
resizing and rounded image on a bootstrap-5 card

Time:01-31

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/[email protected]/dist/css/bootstrap.min.css"
    rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
    crossorigin="anonymous">
    
    

<div >
        <div >
            <div >
                <div >
                    <img  src="https://3.imimg.com/data3/LE/LH/GLADMIN-37134/school-badges-500x500.jpg" alt="">
                    <h1 >{{board.school_name}}</h1>
                    <p>{{board.school_address}}, {{board.location}}</p>
                    <p>P O Box: {{board.p_o_box}}</p>
                </div>
            </div>
        </div>
    </div>

CodePudding user response:

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/[email protected]/dist/css/bootstrap.min.css"
    rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
    crossorigin="anonymous">
    
    

<div >
        <div >
            <div >
                <div >
                    <img  src="https://dummyimage.com/300x300/000/fff.jpg" alt="ff">
                    <h1 >{{board.school_name}}</h1>
                    <p>{{board.school_address}}, {{board.location}}</p>
                    <p>P O Box: {{board.p_o_box}}</p>
                </div>
            </div>
        </div>
    </div>

  • Related