CSS: Round Corners

By Xah Lee. Date: . Last updated: .

Border-radius property

Use border-radius to create round corners.

border-radius is a shorthand for the following properties:

Round corners
.xround-yrncf {
 width: 100px;
 height: 100px;
 border: solid 3px grey;
 border-radius: 10px;
 padding: 8px;
}

Example

border-radius: 0px
border-radius: 10px
border-radius: 20px
border-radius: 30px
border-radius: 40px
border-radius: 50px

Example. circle

use 50% to make it circle, for any square size.

width: 200px; height: 200px; border-radius: 50%

Different radius for each corner

Border radius can be specified for some corners only. The order is:

border-radius: topLeft topRight bottomRight bottomLeft

border-radius: 20px 0 0 0
border-radius: 0 20px 0 0
border-radius: 0 0 20px 0
border-radius: 0 0 0 20px

Omitting border-radius values

Any of the 4 values of border-radius values can be omitted.

2 values (topleft bottomright, topright bottomleft)

border-radius: x y

is same as

border-radius: x y x y

border-radius: 20px 0px;

3 values (topleft, topright bottomleft, bottomright)

border-radius: x y z

is the same as

border-radius: x y z y

border-radius: 30px 0px 10px;

Example. left bracket for quote

something in the water, does not compute

from a song lyrics by Prince.

.quote-bracket-234 {
 all: revert;
 border-left: solid 2px red;
 border-top-left-radius: 8px;
 border-bottom-left-radius: 8px;
 padding-left: 8px;
 margin-left: 16px;
}

Border radius with elliptical corner

each border radius value can be a fraction, like this:

border-radius:50px/10px 0 0 0

The 50px specifies the horizontal radius of a Ellipse, the 10px is the vertical radius.

css border-radius ellipse illustration
border-radius:55pt/25pt (image source http://www.w3.org/TR/css3-background/#the-border-radius)

Example

50px/10px
.br-frac-448 {
 border: solid 3px grey;
 border-radius: 50px/10px;
 width: 100px;
 height: 100px;
 margin: 10px;
}

50px/10px 0 0 0
.br-frac-174 {
 border: solid 3px grey;
 border-radius: 50px/10px 0 0 0;
 width: 100px;
 height: 100px;
 margin: 10px;
}

Browser support

All major browsers support it since 2012.