CSS border-radius
- type
- property
- applies to
- any element
- inherits
- no
- common values
- 4px, 8px, 50%, 999px (a pill)
Where it goes
On the box whose corners should round. It works with or without a visible border, because the background rounds too.
Example
.avatar {
width: 48px;
height: 48px;
border-radius: 50%;
overflow: hidden;
}Common mistakes
- Expecting a child image to round when only the parent has border-radius. The parent also needs overflow: hidden to clip its children to the curve.
- Using 50% on a box that is not square and hoping for a circle. You get an oval. Make the width and height equal first.
- Rounding every single box with a different value. A few consistent sizes (4px for inputs, 12px for cards) read as a system. Random values read as noise.