aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/css/border-radius/index.html
blob: 39e3ab03d7d5a1d770fb5da952f253224a991388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
---
title: border-radius
slug: Web/CSS/border-radius
tags:
  - CSS
  - CSS Borders
  - CSS Property
  - Reference
translation_of: Web/CSS/border-radius
---
<p>{{ CSSRef() }}</p>

<h2 id="Resumen">Resumen</h2>

<p>La propiedad CSS <code>border-radius</code> 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.</p>

<p><img alt="Images of CSS3 rounded corners: no rounding, rounding w/ an arc of circle, rounding w/ an arc of ellipse" class="default internal" src="/files/3638/border-radius-sh.png" style="height: 164px; width: 549px;"></p>

<p>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") }}.</p>

<p>Esta propiedad es un <a href="/en/CSS/Shorthand_properties" title="en/CSS/Shorthand_properties">atajo</a> 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") }}.</p>

<div class="note">As with any shorthand property, individual inherited values are not possible, that is <code>border-radius:0 0 inherit inherit</code>, which would override existing definitions partially. In that case, the individual longhand properties have to be used.</div>

<p>{{cssinfo}}</p>

<h2 id="Sintaxis">Sintaxis</h2>

<pre class="twopartsyntaxbox">Formal grammar: [ <var>&lt;length&gt;</var> | <var>&lt;percentage&gt;</var> ]{1,4}  [ / [ <var>&lt;length&gt;</var> | <var>&lt;percentage&gt;</var> ]{1,4}] ?
                \------------------------------/      \-------------------------------/
                           First radii                     Second radii (optional)
</pre>

<pre><strong>The syntax of the first radius allows one to four values:</strong>
border-radius: <em>radius</em>
border-radius: <em>top-left-and-bottom-right</em> <em>top-right-and-bottom-left</em>
border-radius: <em>top-left</em> <em>top-right-and-bottom-left</em> <em>bottom-right</em>
border-radius: <em>top-left</em> <em>top-right</em> <em>bottom-right</em> <em>bottom-left</em>

<strong>The syntax of the second radius also allows one to four values</strong>
border-radius: (first radius values) / <em>radius</em>
border-radius: (first radius values) / <em>top-left-and-bottom-right</em> <em>top-right-and-bottom-left</em>
border-radius: (first radius values) / <em>top-left</em> <em>top-right-and-bottom-left</em> <em>bottom-right</em>
border-radius: (first radius values) / <em>top-left</em> <em>top-right</em> <em>bottom-right</em> <em>bottom-left</em>

border-radius: inherit
</pre>

<h3 id="Valores">Valores</h3>

<table>
 <tbody>
  <tr>
   <td style="vertical-align: top;"><em>radius</em></td>
   <td><img alt="all-corner.png" class="default internal" src="/@api/deki/files/6138/=all-corner.png"></td>
   <td style="vertical-align: top;">Is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} denoting a radius to use for the border in each corner of the border. It is used only in the one-value syntax.</td>
  </tr>
  <tr>
   <td style="vertical-align: top;"><em>top-left-and-bottom-right</em></td>
   <td><img alt="top-left-bottom-right.png" class="default internal" src="/@api/deki/files/6141/=top-left-bottom-right.png"></td>
   <td style="vertical-align: top;">Is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} 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.</td>
  </tr>
  <tr>
   <td style="vertical-align: top;"><em>top-right-and-bottom-left</em></td>
   <td><img alt="top-right-bottom-left.png" class="default internal" src="/@api/deki/files/6143/=top-right-bottom-left.png"></td>
   <td style="vertical-align: top;">Is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} 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.</td>
  </tr>
  <tr>
   <td style="vertical-align: top;"><em>top-left</em></td>
   <td><img alt="top-left.png" class="default internal" src="/@api/deki/files/6142/=top-left.png"></td>
   <td style="vertical-align: top;">Is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} 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.</td>
  </tr>
  <tr>
   <td style="vertical-align: top;"><em>top-right</em></td>
   <td style="margin-left: 2px;"><img alt="top-right.png" class="default internal" src="/@api/deki/files/6144/=top-right.png"></td>
   <td style="vertical-align: top;">Is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} 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.</td>
  </tr>
  <tr>
   <td style="vertical-align: top;"><em>bottom-right</em></td>
   <td style="margin-left: 2px;"><img alt="bottom-rigth.png" class="default internal" src="/@api/deki/files/6140/=bottom-rigth.png"></td>
   <td style="vertical-align: top;">Is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} 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.</td>
  </tr>
  <tr>
   <td style="vertical-align: top;"><em>bottom-left</em></td>
   <td><img alt="bottom-left.png" class="default internal" src="/@api/deki/files/6139/=bottom-left.png"></td>
   <td style="vertical-align: top;">Is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} 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.</td>
  </tr>
  <tr>
   <td style="vertical-align: top;"><code>inherit</code></td>
   <td> </td>
   <td style="vertical-align: top;">Is a keyword indicating that all four values are inherited from their parent's element calculated value.</td>
  </tr>
 </tbody>
</table>

<h3 id="Valores_2">Valores</h3>

<dl>
 <dt>&lt;length&gt;</dt>
 <dd>Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipsis. It can be expressed in any unit allowed by the CSS {{cssxref("&lt;length&gt;")}} data types. Negative values are invalid.</dd>
 <dt>&lt;percentage&gt;</dt>
 <dd>Denotes the size of the circle radius, or the semi-major and semi-minor axes of the ellipsis, using percentage values. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid.</dd>
</dl>

<p>Por ejemplo:</p>

<pre class="brush: css">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;
</pre>

<pre class="brush: css">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;
</pre>

<h2 id="Ejemplos">Ejemplos</h2>

<pre style="display: inline-block; margin: 10px; border: solid 10px; border-radius: 10px 40px 40px 10px;">  border: solid 10px;
  /* the border will curve into a 'D' */
  border-radius: 10px 40px 40px 10px;
</pre>

<pre style="display: inline-block; margin: 10px; border: groove 1em red; border-radius: 2em;">  border: groove 1em red;
  border-radius: 2em;
</pre>

<pre style="display: inline-block; margin: 10px; background: gold; border: ridge gold; border-radius: 13em/3em;">  background: gold;
  border: ridge gold;
  border-radius: 13em/3em;
</pre>

<pre style="display: inline-block; margin: 10px; background: gold; border: none; border-radius: 40px 10px;">  border: none;
  border-radius: 40px 10px;
</pre>

<pre style="display: inline-block; margin: 10px; background: black; color: white; border: none; border-radius: 50%;">  border: none;
  border-radius: 50%;
</pre>

<h2 id="Notas">Notas</h2>

<ul>
 <li>Dotted and dashed rounded border corners are rendered as solid in Gecko; see {{ bug("382721") }}.</li>
 <li><code>border-radius</code> does not apply to table elements when {{ Cssxref("border-collapse") }} is <code>collapse</code>.</li>
 <li>Old versions of WebKit handle multiple values differently, see below.</li>
</ul>

<h2 id="Especificaciones">Especificaciones</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('CSS3 Backgrounds', '#border-radius', 'border-radius') }}</td>
   <td>{{ Spec2('CSS3 Backgrounds') }}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilidad_con_los_navegadores">Compatibilidad con los navegadores</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Firefox (Gecko)</th>
   <th>Chrome</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatGeckoDesktop("2.0") }}<br>
    {{ CompatGeckoDesktop("1.0") }}{{ property_prefix("-moz") }}</td>
   <td>4.0<br>
    0.2{{ property_prefix("-webkit") }}</td>
   <td>9.0</td>
   <td>10.5</td>
   <td>5.0<br>
    3.0{{ property_prefix("-webkit") }}</td>
  </tr>
  <tr>
   <td>Elliptical borders</td>
   <td>{{ CompatGeckoDesktop("1.9.1") }}</td>
   <td>yes</td>
   <td>yes</td>
   <td>yes</td>
   <td>yes, but see below</td>
  </tr>
  <tr>
   <td>4 values for 4 corners</td>
   <td>yes</td>
   <td>4.0</td>
   <td>yes</td>
   <td>yes</td>
   <td>5.0</td>
  </tr>
  <tr>
   <td>Percentages</td>
   <td>yes<br>
    was {{ non-standard_inline() }} (see below)</td>
   <td>yes</td>
   <td>yes</td>
   <td>11.5</td>
   <td>5.1</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>iOS Safari</th>
   <th>Opera Mini</th>
   <th>Opera Mobile</th>
   <th>Android Browser</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>3.2{{ property_prefix("-webkit") }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>2.1{{ property_prefix("-webkit") }}</td>
  </tr>
  <tr>
   <td>Elliptical borders</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
  <tr>
   <td>4 values for 4 corners</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
  <tr>
   <td>Percentages</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<h3 id="&lt;percentage>_values"><code>&lt;percentage&gt;</code> values</h3>

<ul>
 <li>are not supported in older Chrome and Safari versions (it was <a class="external" href="http://trac.webkit.org/changeset/66615">fixed in Sepember 2010</a>)</li>
 <li>are buggy in Opera prior to 11.50</li>
 <li>are implemented in a non-standard way prior to Gecko 2.0 (Firefox 4). <strong>Both</strong> horizontal and vertical radii were relative to the width of the border box.</li>
 <li>are not supported in older versions of iOS (prior to 5) and Android versions (prior to WebKit 532)</li>
</ul>

<h3 id="Gecko_notes">Gecko notes</h3>

<p>In Gecko 2.0 <code>-moz-border-radius</code> was renamed to <code>border-radius</code>; <code>-moz-border-radius</code> was supported as an alias until Gecko 12.0. In order to conform to the CSS3 standard, Gecko 2.0</p>

<ul>
 <li>changes the handling of {{cssxref("&lt;percentage&gt;")}} values to match the specification. You can specify an ellipse as border on an arbitrary sized element just with <code>border-radius: 50%;</code></li>
 <li>makes rounded corners clip content and images (if {{ cssxref("overflow") }}<code>: visible</code> is not set)</li>
</ul>

<div class="note"><strong>Note:</strong> Support for the prefixed version (<code>-moz-border-radius</code>) was removed in Gecko 13.0 {{ geckoRelease("13.0") }}.</div>

<h3 id="WebKit_notes">WebKit notes</h3>

<p>Older Safari and Chrome versions (prior to WebKit 532.5)</p>

<ul>
 <li>support only <strong>one</strong> value for all 4 corners. For different radii the <a href="/en/CSS/border-top-left-radius#Examples" title="en/CSS/border-top-left-radius#Examples">long form properties</a> must be used</li>
 <li>don't support the slash <code>/</code> notation. If two values are specified, an elliptical border is drawn on all 4 corners
  <pre>/* this is equivalent: */

-webkit-border-radius: 40px 10px;
        border-radius: 40px/10px;
</pre>
 </li>
</ul>

<h3 id="Opera_notes">Opera notes</h3>

<p>In Opera (prior to Opera 11.60), applying <code>border-radius</code> to replaced elements will not have rounded corners.</p>

<h2 id="Vea_también">Vea también</h2>

<ul>
 <li>Border-radius-related CSS properties: {{ Cssxref("border-top-left-radius") }}, {{ Cssxref("border-top-right-radius") }}, {{ Cssxref("border-bottom-right-radius") }}, {{ Cssxref("border-bottom-left-radius") }}</li>
</ul>

<p>{{ languages( { "de": "de/CSS/border-radius", "fr": "fr/CSS/-moz-border-radius", "ja": "ja/CSS/border-radius", "pl": "pl/CSS/-moz-border-radius" } ) }}</p>