Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

border-radius — rounding corners

`border-radius` sets the radii of the four border corners. It accepts lengths, percentages, and separate horizontal and vertical radii divided by a slash.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

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

border-radius is a shorthand setting the four corner-radius properties. It also rounds backgrounds without a visible border. Radii initially equal 0; the property is not inherited. Negative values are invalid.

Four values address top-left, top-right, bottom-right, and bottom-left, in that order. One value applies everywhere; two expand to a b a b, and three to a b c b. Values before / set horizontal radii; values after it set vertical radii. Without /, the same list sets both axes. Percentages refer respectively to the border box’s width and height.

The browser proportionally reduces all radii if adjacent corners would overlap. 50% produces a circle only for a square box; a rectangle produces an ellipse. border-radius alone does not clip descendant content: when clipping is required, you can add overflow: hidden, remembering that it also hides other overflowing content.

Examples

<!doctype html>
<meta charset="utf-8">
<title>border-radius</title>
<style>
  .box {
    box-sizing: border-box;
    width: 200px;
    height: 100px;
    background: #2463eb;
    border-radius: 40px / 20px;
  }
</style>
<div class="box"></div>

Result

A blue 200px × 100px border box with four elliptical corners, each with a 40px horizontal radius and a 20px vertical radius.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources