border-radius CSS property sets the rounded shape for the border corners of an element. It is a shorthand property for
The following table summarizes the usages context and the version history of this property.
|Applies to:||All elements|
|Animatable:||Yes. See animatable properties.|
|Version:||New in CSS3|
border-radius property also causes the element's background to be rounded even if no borders have been defined or its value is set to
The syntax of the property is given with:
This shorthand notation can take one, two, three, or four whitespace separated values.
- If one value is specified, it defines the radius of all corners.
- If two values are specified, the first value is used for the top-left and bottom-right corner, while the second value is used for the top-right and bottom-left sides corner.
- If three values are specified, the first value is used for the top-left corner, the second value is used for the top-right and bottom-left corner, and the third value is used for the bottom-right corner.
- If four values are specified, each value applies to the border individually in the order top-left, top-right, bottom-right, and bottom-left corner.
The example below shows the
border-radius property in action.
ExampleTry this code »
border: 2px solid #f08080;
Note: The optional second length values, preceded by a "/", define the vertical radii for the corner and the corner shape is thus a quarter ellipse. If the second length is omitted, or it is equal to the first — the corner shape is a quarter circle. If either length is zero, the corner is square, not rounded.
The following table describes the values of this property.
|length||A length value in
|percentage||The size of the radius in percentage. In case of elliptical corners, percentage for the horizontal radius is calculated with respect to the width of the element's box, while percentage for the vertical radius is calculated with respect to the height of the element's box. Negative values are not allowed.|
||Sets this property to its default value.|
||If specified, the associated element takes the computed value of its parent element
border-radius property is supported in all major modern browsers.
Warning: Internet Explorer 8 and earlier versions do not support the
border-radius property. supported in IE9 and above.