Making a Rounded Border Around an Image with CSS

Suppose you want to round the right-angle corners of an image border, set the border value and then use the CSS3 border-radius property along with its browser-specific border-radius properties.

The radius is half the distance of a circle’s diameter and is used to set the amount of curvature on the corner. The higher the value for the radius, the more rounded the corner will be. At the time of this writing, the border-radius property isn’t supported as is; however, the proprietary properties in both Firefox and Safari replicate the effect. The main drawback (other than cross-browser support) is that the names of the border properties are not consistent.


background-image: url(beach.jpg);
width: 375px;
height: 500px;
border: 8px solid #666;
border-radius: 40px;
-moz-border-radius: 40px;
-webkit-border-radius: 40px;

Rounded corner property equivalents:

See also: Setting background image with CSS

Leave a Comment