CSS border-radius Property
Example
#example1 {
border: 2px solid red;
padding: 10px;
border-radius: 25px;
}
#example2 {
border: 2px solid red;
padding: 10px;
border-radius: 50px 25px;
}
#example3 {
border: 2px solid red;
padding: 10px;
border-radius: 50px 25px 10px;
}
Hello World!
Meaning
The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radius to make elliptical corners.
How to use border-radius property:
1. If border-radius property has 4 values: border-radius: 10px 20px 30px 40px;
- top-left border radius is 10px
- top-right border radius is 20px
- bottom-right border radius is 30px
- bottom-left border radius is 40px
Example:
2. If border-radius property has 4 values: border-radius: 10px 20px 30px;
- top-left border radius is 10px
- top-right and bottom-left borders radius are 20px
- bottom-right border radius is 30px
Example:
3. If border-radius property has 2 values: border-radius: 10px 20px;
- top-left and bottom-right borders radius are 10px
- top-right and bottom-left borders radius are 20px
Example:
4. If border-radius property has 1 values: border-radius: 10px;
- top-left, bottom-right, top-right and bottom-left borders radius are 10px
Example:
Default value: | 0 |
Inherited: | No |
Animatable: | Yes |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
border-radius: 1-4 length|% / 1-4 length|%|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
length | Default value is 0. Specifies the shape of the corners. |
%(percentage) | Defines the shape of the corners in percentage. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
border-radius: 0;
}