I want to make a centered circular image from rectangle photo. The photo\'s dimensions is unknown. Usually it\'s a rectangle form. I\'ve tried a lot of methods:
CSS:
I know many of the solutions mentioned above works, you can as well try flex.
But my image was rectangular and not fitting properly. so this is what i did.
.parentDivClass {
position: relative;
height: 100px;
width: 100px;
overflow: hidden;
border-radius: 50%;
margin: 20px;
display: flex;
justify-content: center;
}
and for the image inside, you can use,
child Img {
display: block;
margin: 0 auto;
height: 100%;
width: auto;
}
This is helpful when you are using bootstrap 4 classes.