From simple corners to the 8-value shorthand
border-radius rounds the element’s box, and it scales from trivial to expressive:
- One value —
border-radius: 12pxrounds all four corners equally. - Four values —
TL TR BR BLfor per-corner control. - Eight values —
TL TR BR BL / TL TR BR BL(a slash separates horizontal from vertical radii), giving each corner an elliptical curve. This is the basis of organic blob shapes.
50% on a square makes a perfect circle; on a rectangle, an ellipse. For fully rounded pill ends, the 9999px trick above beats 50%.
px vs % — pick by intent
| Unit | Behavior | Use for |
|---|---|---|
px | Fixed radius regardless of size | Design-system tokens, consistent corners |
% | Relative to element dimensions | Circles, pills, proportional rounding |
px keeps corners visually consistent across differently-sized elements (what a design system usually wants); % scales the rounding with the element.
The overflow rule for images
border-radius rounds the element’s own border and background, but child content isn’t clipped to the curve by default — an image inside a rounded card will poke square corners out past the rounding. The fix is overflow: hidden on the rounded container, which clips children (especially <img>) to the rounded shape. This is essential for rounded thumbnails, avatars, and cards.
Blobs and animation
The 8-value shorthand with varying radii produces fluid, asymmetric blob shapes popular for decorative accents and hero backgrounds — this generator includes blob presets and a randomize button. And border-radius is fully animatable: the browser interpolates each of the eight radii independently, so you can morph a rounded rectangle into a circle or between two blobs on hover. Note that if a radius exceeds half the smallest dimension the browser caps it, so very large values simply give maximum rounding rather than the literal number.