--- title: border-radius slug: Web/CSS/border-radius tags: - CSS - CSS Borders - CSS Property - Reference translation_of: Web/CSS/border-radius ---
{{ CSSRef() }}
La propiedad CSS border-radius
permite a los desarrolladores Web definir qué tan redondeadas serán las esquinas. La redondez de cada esquina está definida usando uno o dos valores para el radio que define su forma dependiendo si es un círculo o una elipse.
El radio se aplica a todo el {{ Cssxref("background") }}, aun si el elemento no tiene bordes; la posición exacta del recorte es definida por la propiedad {{ Cssxref("background-clip") }}.
Esta propiedad es un atajo para establecer las cuatro propiedades {{ Cssxref("border-top-left-radius") }}, {{ Cssxref("border-top-right-radius") }}, {{ Cssxref("border-bottom-right-radius") }} y {{ Cssxref("border-bottom-left-radius") }}.
border-radius:0 0 inherit inherit
, which would override existing definitions partially. In that case, the individual longhand properties have to be used.{{cssinfo}}
Formal grammar: [ <length> | <percentage> ]{1,4} [ / [ <length> | <percentage> ]{1,4}] ? \------------------------------/ \-------------------------------/ First radii Second radii (optional)
The syntax of the first radius allows one to four values: border-radius: radius border-radius: top-left-and-bottom-right top-right-and-bottom-left border-radius: top-left top-right-and-bottom-left bottom-right border-radius: top-left top-right bottom-right bottom-left The syntax of the second radius also allows one to four values border-radius: (first radius values) / radius border-radius: (first radius values) / top-left-and-bottom-right top-right-and-bottom-left border-radius: (first radius values) / top-left top-right-and-bottom-left bottom-right border-radius: (first radius values) / top-left top-right bottom-right bottom-left border-radius: inherit
radius | Is a {{cssxref("<length>")}} or a {{cssxref("<percentage>")}} denoting a radius to use for the border in each corner of the border. It is used only in the one-value syntax. | |
top-left-and-bottom-right | Is a {{cssxref("<length>")}} or a {{cssxref("<percentage>")}} denoting a radius to use for the border in the top-left and bottom-right corners of the element's box. It is used only in the two-value syntax. | |
top-right-and-bottom-left | Is a {{cssxref("<length>")}} or a {{cssxref("<percentage>")}} denoting a radius to use for the border in the top-right and bottom-left corners of the element's box. It is used only in the two- and three-value syntaxes. | |
top-left | Is a {{cssxref("<length>")}} or a {{cssxref("<percentage>")}} denoting a radius to use for the border in the top-left corner of the element's box. It is used only in the three- and four-value syntaxes. | |
top-right | Is a {{cssxref("<length>")}} or a {{cssxref("<percentage>")}} denoting a radius to use for the border in the top-right corner of the element's box. It is used only in the four-value syntax. | |
bottom-right | Is a {{cssxref("<length>")}} or a {{cssxref("<percentage>")}} denoting a radius to use for the border in the bottom-right corner of the element's box. It is used only in the three- and four-value syntaxes. | |
bottom-left | Is a {{cssxref("<length>")}} or a {{cssxref("<percentage>")}} denoting a radius to use for the border in the bottom-left corner of the element's box. It is used only in the four-value syntax. | |
inherit |
Is a keyword indicating that all four values are inherited from their parent's element calculated value. |
Por ejemplo:
border-radius: 1em/5em; /* es equivalente a: */ border-top-left-radius: 1em 5em; border-top-right-radius: 1em 5em; border-bottom-right-radius: 1em 5em; border-bottom-left-radius: 1em 5em;
border-radius: 4px 3px 6px / 2px 4px; /* es equivalente a: */ border-top-left-radius: 4px 2px; border-top-right-radius: 3px 4px; border-bottom-right-radius: 6px 2px; border-bottom-left-radius: 3px 4px;
border: solid 10px; /* the border will curve into a 'D' */ border-radius: 10px 40px 40px 10px;
border: groove 1em red; border-radius: 2em;
background: gold; border: ridge gold; border-radius: 13em/3em;
border: none; border-radius: 40px 10px;
border: none; border-radius: 50%;
border-radius
does not apply to table elements when {{ Cssxref("border-collapse") }} is collapse
.Specification | Status | Comment |
---|---|---|
{{ SpecName('CSS3 Backgrounds', '#border-radius', 'border-radius') }} | {{ Spec2('CSS3 Backgrounds') }} |
{{ CompatibilityTable() }}
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{ CompatGeckoDesktop("2.0") }} {{ CompatGeckoDesktop("1.0") }}{{ property_prefix("-moz") }} |
4.0 0.2{{ property_prefix("-webkit") }} |
9.0 | 10.5 | 5.0 3.0{{ property_prefix("-webkit") }} |
Elliptical borders | {{ CompatGeckoDesktop("1.9.1") }} | yes | yes | yes | yes, but see below |
4 values for 4 corners | yes | 4.0 | yes | yes | 5.0 |
Percentages | yes was {{ non-standard_inline() }} (see below) |
yes | yes | 11.5 | 5.1 |
Feature | iOS Safari | Opera Mini | Opera Mobile | Android Browser |
---|---|---|---|---|
Basic support | 3.2{{ property_prefix("-webkit") }} | {{ CompatNo() }} | {{ CompatNo() }} | 2.1{{ property_prefix("-webkit") }} |
Elliptical borders | {{ CompatUnknown() }} | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatUnknown() }} |
4 values for 4 corners | {{ CompatUnknown() }} | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatUnknown() }} |
Percentages | {{ CompatUnknown() }} | {{ CompatNo() }} | {{ CompatNo() }} | {{ CompatUnknown() }} |
<percentage>
valuesIn Gecko 2.0 -moz-border-radius
was renamed to border-radius
; -moz-border-radius
was supported as an alias until Gecko 12.0. In order to conform to the CSS3 standard, Gecko 2.0
border-radius: 50%;
: visible
is not set)-moz-border-radius
) was removed in Gecko 13.0 {{ geckoRelease("13.0") }}.Older Safari and Chrome versions (prior to WebKit 532.5)
/
notation. If two values are specified, an elliptical border is drawn on all 4 corners
/* this is equivalent: */ -webkit-border-radius: 40px 10px; border-radius: 40px/10px;
In Opera (prior to Opera 11.60), applying border-radius
to replaced elements will not have rounded corners.
{{ languages( { "de": "de/CSS/border-radius", "fr": "fr/CSS/-moz-border-radius", "ja": "ja/CSS/border-radius", "pl": "pl/CSS/-moz-border-radius" } ) }}