Baseline Widely available
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 radii to make elliptical corners.
border-radius: 10% 30% 50% 70%;
border-radius: 10% / 50%;
border-radius: 10px 100px / 120px;
border-radius: 50% 20% / 10% 40%;
<section class="default-example" id="default-example">
<div class="transition-all" id="example-element">
This is a box with rounded corners.
</div>
</section>
#example-element {
width: 80%;
height: 80%;
display: flex;
justify-content: center;
flex-direction: column;
background-color: #5b6dcd;
color: white;
padding: 10px;
}
The radius applies to the whole background
, even if the element has no border; the exact position of the clipping is defined by the background-clip
property.
The border-radius
property does not apply to table elements when border-collapse
is collapse
.
Note: As with any shorthand property, individual sub-properties cannot inherit, such as in border-radius:0 0 inherit inherit
, which would partially override existing definitions. Instead, the individual longhand properties have to be used.
/* The syntax of the first radius allows one to four values */
/* Radius is set for all 4 sides */
border-radius: 10px;
/* top-left-and-bottom-right | top-right-and-bottom-left */
border-radius: 10px 5%;
/* top-left | top-right-and-bottom-left | bottom-right */
border-radius: 2px 4px 2px;
/* top-left | top-right | bottom-right | bottom-left */
border-radius: 1px 0 3px 4px;
/* The syntax of the second radius allows one to four values */
/* (first radius values) / radius */
border-radius: 10px / 20px;
/* (first radius values) / top-left-and-bottom-right | top-right-and-bottom-left */
border-radius: 10px 5% / 20px 30px;
/* (first radius values) / top-left | top-right-and-bottom-left | bottom-right */
border-radius: 10px 5px 2em / 20px 25px 30%;
/* (first radius values) / top-left | top-right | bottom-right | bottom-left */
border-radius: 10px 5% / 20px 25em 30px 35em;
/* Global values */
border-radius: inherit;
border-radius: initial;
border-radius: revert;
border-radius: revert-layer;
border-radius: unset;
The border-radius
property is specified as:
<length>
or <percentage>
values. This is used to set a single radius for the corners.<length>
or <percentage>
values. This is used to set an additional radius, so you can have elliptical corners.border-radius =Examples
<length-percentage [0,â]>{1,4} [ / <length-percentage [0,â]>{1,4} ]?<length-percentage> =
<length> |
<percentage>
<pre id="example-1">
border: solid 10px;
border-radius: 10px 40px 40px 10px;
</pre>
<pre id="example-2">
border: groove 1em red;
border-radius: 2em;
</pre>
<pre id="example-3">
background: gold;
border: ridge gold;
border-radius: 13em/3em;
</pre>
<pre id="example-4">
border: none;
border-radius: 40px 10px;
background: gold;
</pre>
<pre id="example-5">
border: none;
border-radius: 50%;
background: burlywood;
</pre>
<pre id="example-6">
border: dotted;
border-width: 10px 4px;
border-radius: 10px 40px;
</pre>
<pre id="example-7">
border: dashed;
border-width: 2px 4px;
border-radius: 40px;
</pre>
pre {
margin: 20px;
padding: 20px;
width: 80%;
height: 80px;
}
pre#example-1 {
border: solid 10px;
border-radius: 10px 40px 40px 10px;
}
pre#example-2 {
border: groove 1em red;
border-radius: 2em;
}
pre#example-3 {
background: gold;
border: ridge gold;
border-radius: 13em/3em;
}
pre#example-4 {
border: none;
border-radius: 40px 10px;
background: gold;
}
pre#example-5 {
border: none;
border-radius: 50%;
background: burlywood;
}
pre#example-6 {
border: dotted;
border-width: 10px 4px;
border-radius: 10px 40px;
}
pre#example-7 {
border: dashed;
border-width: 2px 4px;
border-radius: 40px;
}
Live Samples Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3