What Is CSS border-radius Property?
The CSS `border-radius` property rounds the corners of an element's outer border edge by defining the radii of elliptical or circular corner curves, as specified in the CSS Backgrounds and Borders Module Level 3 (W3C). It is a shorthand property that controls up to four individual corner radii — `border-top-left-radius`, `border-top-right-radius`, `border-bottom-right-radius`, and `border-bottom-left-radius` — and supports both single-radius (circular) and dual-radius (elliptical) values. Unlike older hacks using background images or nested elements, `border-radius` achieves corner rounding purely in CSS without affecting the element's document flow or box model dimensions.
What Is CSS border-radius Property?
The CSS `border-radius` property rounds the corners of an element's outer border edge by defining the radii of elliptical or circular corner curves, as specified in the CSS Backgrounds and Borders Module Level 3 (W3C). It is a shorthand property that controls up to four individual corner radii — `border-top-left-radius`, `border-top-right-radius`, `border-bottom-right-radius`, and `border-bottom-left-radius` — and supports both single-radius (circular) and dual-radius (elliptical) values. Unlike older hacks using background images or nested elements, `border-radius` achieves corner rounding purely in CSS without affecting the element's document flow or box model dimensions.
How CSS border-radius Property Works
At the browser rendering level, `border-radius` instructs the painting engine to clip the corner regions of an element's background, border, and box-shadow using a quarter-ellipse curve. The browser calculates the curve using two radii: horizontal (x-axis) and vertical (y-axis). When you provide a single value like `border-radius: 12px`, both radii are equal, producing a circular arc. When you use the slash syntax — `border-radius: 20px / 10px` — the first value sets the horizontal radius and the second sets the vertical radius, creating an elliptical corner curve. The shorthand `border-radius` follows a specific value order: top-left, top-right, bottom-right, bottom-left — the same clockwise pattern used by `margin` and `padding`. When fewer than four values are supplied, the browser applies CSS shorthand inference rules: one value applies to all corners, two values apply top-left/bottom-right and top-right/bottom-left respectively, and three values apply top-left, top-right/bottom-left, and bottom-right. This mirrors the behavior defined in the CSS Backgrounds and Borders Module Level 3 specification (https://www.w3.org/TR/css-backgrounds-3/). Border radius interacts with the CSS box model in important ways. It clips the `background-color` and `background-image` of the element (controlled by `background-clip`), clips the `border` rendering itself, and also clips the `box-shadow` spread if the shadow is inset. Crucially, `border-radius` does not clip child elements — for that, you must also apply `overflow: hidden` to the parent. This is a common source of bugs when developers expect child images or divs to be clipped by the parent's rounded corners. Browser support for `border-radius` is universal across all modern browsers and has been since IE9+ without vendor prefixes. The `-webkit-border-radius` prefix was required for Safari 4 and Chrome 3 but is now obsolete. A special case worth knowing: setting `border-radius: 50%` on an element with equal width and height produces a perfect circle, because 50% of each dimension meets at the center. On elements with unequal dimensions, `50%` produces an ellipse. The `border-radius` property also participates in CSS transitions and animations — corners can be smoothly interpolated between two radius values, enabling techniques like morphing shapes on hover.
Best Practices for CSS border-radius Property
Use percentage-based values (`border-radius: 50%`) for shape-dependent elements like avatars and icon containers where the element's dimensions may change, since percentages adapt automatically — fixed pixel values will produce incorrect ellipses on non-square elements. Apply `overflow: hidden` alongside `border-radius` on any container that holds child elements (particularly `<img>` tags) you want visually clipped, since `border-radius` alone does not clip children and will produce visible overflow corners. Leverage the longhand individual corner properties (`border-top-left-radius`, etc.) when you need asymmetric rounding — for example, pill-shaped tabs that are only rounded on top — rather than overriding shorthand values, which improves code clarity and avoids shorthand inference bugs. Avoid applying large `border-radius` values to elements with complex `box-shadow` or `border` styles on low-powered mobile devices without testing, as painting rounded corners with multiple visual layers can trigger GPU compositing and increase paint time; keep radius values consistent across a design system using CSS custom properties (e.g., `--radius-card: 12px`) so changes propagate site-wide from a single source of truth.
CSS border-radius Property & Canvas Builder
Canvas Builder generates Bootstrap 5 HTML output that leverages the full Bootstrap border-radius utility system, applying classes like `.rounded-3` or `.rounded-circle` directly on semantic elements — `<img>`, `<div>`, `<button>` — rather than scattering inline `border-radius` styles throughout the markup, which would make design-system-level changes difficult. The clean, class-based HTML that Canvas Builder produces means developers can customize the global radius scale by overriding Bootstrap's `--bs-border-radius` CSS custom properties or Sass variables, instantly propagating changes across every card, badge, modal, and avatar in the generated site. Because Canvas Builder outputs valid, standards-compliant HTML without presentational div-soup or legacy hacks, `border-radius` behaves predictably across the generated components with no browser-specific workarounds needed.
Try Canvas Builder →