CSS Portal

CSS border-radius Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The border-radius property controls the curvature of an element’s corners, allowing designers to soften rectangular boxes into rounded rectangles, pills or circles. By defining radii for corners, it changes the shape used for the box’s border and background painting without altering the document flow or box model (the element keeps its original width/height and layout slot). It supports both uniform rounding for all corners and independent control per corner, and can create elliptical curves by specifying different horizontal and vertical radii for a corner.

Because the rounded shape affects how the element is painted and how its edges appear, border-radius interacts closely with other visual properties. For example, shadows and focus glows typically follow the rounded outline when applied with box-shadow, borders draw along the curved edge (see border), and the element’s background can either be clipped to the rounded area or extend underneath depending on the painting rules controlled by background-clip. If you want inner content clipped to the rounded corners so child elements or overflowing content don’t spill outside, combine rounded corners with an appropriate overflow setting.

Beyond simple rounding, border-radius is a useful tool for shaping UI components. Large equal radii on square elements produce circles (commonly used for avatars), while asymmetric radii yield more organic shapes for cards or controls. For complex or non-rectangular shapes you can use clipping techniques in concert with rounding - for instance, pairing rounded corners with clip-path lets you create intricate silhouettes that go beyond what radii alone can produce. In practical use, keep accessibility and contrast in mind: rounded corners change the visual weight of controls and may affect the appearance of focus indicators, so ensure focus styles remain clearly visible when corners are rounded (often implemented using box-shadow or contrasting borders).

Definition

Initial value
See individual properties
Applies to
All elements
Inherited
No
Computed value
See individual properties
Animatable
Yes
JavaScript syntax
object.style.borderRadius

Interactive Demo

Demo of the border radius property.

Syntax

border-radius: [ <length> | <percentage> ]{1,4} [ / [ <length> | <percentage> ]{1,4} ]?

Values

  • <length>Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipsis. It can be expressed in any unit allowed by the CSS <length> data types. Negative values are invalid.
  • <percentage>Denotes the size of the circle radius, or the semi-major and semi-minor axes of the ellipsis, using percentage values. Percentages for the horizontal axe refer to the width of the box, percentages for the vertical axe refer to the height of the box. Negative values are invalid.

Example

<div class="container">
<h2>Border Radius Examples</h2>
<div class="examples">
<div class="card">
<img class="avatar" src="https://placehold.co/100" alt="Avatar">
<h3>Rounded Card</h3>
<p>Uses border-radius for the card container.</p>
<button class="btn">Rounded Button</button>
</div>

<div class="circle" aria-hidden="true"></div>

<div class="pill">Pill Shape</div>

<div class="asymmetric">Asymmetric Corners</div>
</div>
</div>
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: #f4f7fb;
  padding: 32px;
  display: flex;
  justify-content: center;
}

.container {
  max-width: 900px;
  width: 100%;
}

h2 {
  margin: 0 0 16px 0;
  color: #0f172a;
}

.examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(2,6,23,0.08);
  text-align: left;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: block;
  margin-bottom: 12px;
}

.btn {
  background: #2563eb;
  color: #fff;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.circle {
  background: #10b981;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto;
}

.pill {
  background: #f97316;
  color: #fff;
  padding: 12px 24px;
  border-radius: 9999px;
  text-align: center;
}

.asymmetric {
  background: #ef4444;
  color: #fff;
  padding: 20px;
  border-radius: 20px 4px 20px 4px; /* top-left, top-right, bottom-right, bottom-left */
  text-align: center;
}

Browser Support

The following information will show you the current browser support for the CSS border-radius property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!