CSS3 border-radiusProperty
Example
Add rounded borders to two div elements:
Try it Yourself »
Browser Support
The numbers in the table indicate the first browser version number that supports the property.
The number immediately preceding -webkit-, -ms-, or -moz- is the first browser version number that supports the prefixed property.
| Property | |||||
|---|---|---|---|---|---|
| border-radius | 4.0 -webkit- | 9.0 | 4.0 -moz- | 5.0 -webkit- | 10.5 -o- |
Attribute Definition and Usage Instructions
border-radius allows you to set rounded corners for an element's outer border. When one radius is used, a circle is determined; when two radii are used, an ellipse is determined. The intersection of this ellipse with the border creates the rounded corner effect.
The border-radius property is one that can specify up to fourborder-*-radiusCompound properties of attributes
Tip:This property allows you to add rounded borders to elements!
| Default Value: | 0 |
|---|---|
| Inherited: | no |
| version: | CSS3 |
| JavaScript Syntax: | object object.style.borderRadius="5px" |
Syntax
Note:The order of the four values for each radius is: top-left, top-right, bottom-right, bottom-left. If bottom-left is omitted, it is the same as top-right. If bottom-right is omitted, it is the same as top-left. If top-right is omitted, it is the same as top-left.
| Value | Description |
|---|---|
| length | Defines the shape of the curve. |
| % | Use % to define the shape of the corner. |
/* Equivalent to: */
border-top-left-radius: 1em 5em;
border-top-right-radius: 1em 5em;
border-bottom-right-radius: 1em 5em;
border-bottom-left-radius: 1em 5em;
/* Equivalent to: */
border-top-left-radius: 4px 2px;
border-top-right-radius: 3px 4px;
border-bottom-right-radius: 6px 2px;
border-bottom-left-radius: 3px 4px;
Elliptical border border-radius: 15px 50px 30px 5px: The first value applies to the top-left corner, the second value to the top-right corner, the third value to the bottom-right corner, and the fourth value to the bottom-left corner:
Elliptical border border-radius: 15px 50px 30px: The first value applies to the top-left corner, the second value to the top-right and bottom-left corners, and the third value to the bottom-right corner:
Elliptical border border-radius: 15px 50px: The first value applies to the top-left and bottom-right corners, and the second value to the top-right and bottom-left corners
Elliptical border border-radius: 15px: The value applies to all four corners, with equal rounded corners.
More Examples
Example
Background image with border
Try it Yourself »
Example
Different types of parameters
Try it Yourself »
Example
Different numbers of parameters
Try it Yourself »
Example
Shorthand format:
Try it Yourself »
Related Articles
CSS3 Tutorial:CSS3 Border
other extensions