I'd like to create a round image from a rectangular image using radius-border.
Is there simple way to achieve this with CSS without distorting the image AND ensuring a circle is perfectly round.
See failed attempts here:
http://jsfiddle.net/v8g3y0na/
.rounded-corners-2{ border-radius: 100px; height: 150px; width: 150px;
Can this be done in only CSS.....?
The border-radius CSS property is what adds the rounded corners. You can experiment with different values to get it the way you like. border-radius: 75px; If you want it to be a circle, add border-radius: 50%; .
The main CSS property responsible for the circular shape is the border-radius property. Setting the radius of the corners to 50% of the width/height results in a circle.
The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.
You do that by adding a parent div to your img and the code flows as follows
figure{ width:150px; height:150px; border-radius:50%; overflow:hidden; }
Updated Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With