div{
border:2px solid;
border-radius:25px;
}Definition and usage
border-radius Property is a shorthand property for setting the four border-radius properties.
Tip: This property allows you to add rounded borders to elements!
| Default value: | 0 |
|---|---|
| Inheritance: | no |
| Version: | CSS3 |
| JavaScript syntax: | object.style.borderRadius="5px" |
Grammar
border-radius: 1-4 length|% / 1-4 length|%;Note: Set each radii of four values. If omitted bottom-left, then with top-right Same.
If omitted bottom-right, then with top-left Same. If omitted top-right, then with top-left Same.
| 值 | Description |
|---|---|
| length | Defines the shape of the fillet. |
| % | Defines the shape of the fillet as a percentage. |
Example 1
border-radius:2em;Equivalent to:
border-top-left-radius:2em;
border-top-right-radius:2em;
border-bottom-right-radius:2em;
border-bottom-left-radius:2em;Example 2
border-radius: 2em 1em 4em / 0.5em 3em;Equivalent to:
border-top-left-radius: 2em 0.5em;
border-top-right-radius: 1em 3em;
border-bottom-right-radius: 4em 0.5em;
border-bottom-left-radius: 1em 3em;