aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/border-bottom-right-radius/index.html
blob: d63776da87cb0acb2911dac2193649287fa147d8 (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
---
title: border-bottom-right-radius
slug: Web/CSS/border-bottom-right-radius
translation_of: Web/CSS/border-bottom-right-radius
---
<div>{{CSSRef}}</div>

<p>The <strong><code>border-bottom-right-radius</code></strong> CSS property sets the rounding of the bottom-right corner of the element.</p>

<pre class="brush:css no-line-numbers">/* The corner is a circle */
/* border-bottom-right-radius: <em>radius</em> */
border-bottom-right-radius: 3px;

/* Percentage values */
border-bottom-right-radius: 20%; /* corner of a circle if box is a square or else corner of a rectangle */
border-bottom-right-radius: 20% 20%; /* same as above */ /* 20% of horizontal(width) and vertical(height) */
border-bottom-right-radius: 20% 10%; /* 20% of horizontal(width) and 10% of vertical(height) */

/*The corner is an ellipsis */
/* border-bottom-right-radius: horizontal vertical */
border-bottom-right-radius: 0.5em 1em;

border-bottom-right-radius: inherit;</pre>

<p>The rounding can be a circle or an ellipse, or if one of the value is <code>0</code> no rounding is done and the corner is square.</p>

<div style="text-align: center;"><img alt="border-bottom-right-radius.png" class="default internal" src="/@api/deki/files/6134/=border-bottom-right-radius.png"></div>

<p>A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the {{cssxref("background-clip")}} property.</p>

<div class="note">If the value of this property is not set in a {{cssxref("border-radius")}} shorthand property that is applied to the element after the <code>border-bottom-right-radius</code> CSS property, the value of this property is then reset to its initial value by the <a href="/en-US/docs/Web/CSS/Shorthand_properties">shorthand property</a>.</div>

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

<h2 id="Syntax">Syntax</h2>

<p>With one value:</p>

<ul>
 <li>the value is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} denoting the radius of the circle to use for the border in that corner.</li>
</ul>

<p>With two values:</p>

<ul>
 <li>the first value is a {{cssxref("&lt;length&gt;")}} or a {{cssxref("&lt;percentage&gt;")}} denoting the horizontal semi-major axis of the ellipsis to use for the border in that corner.</li>
 <li>the second value is a {{cssxref("&lt;percentage&gt;")}} denoting the vertical semi-major axis of the ellipsis to use for the border in that corner.</li>
</ul>

<h3 id="Values">Values</h3>

<dl>
 <dt><code>&lt;length-percentage&gt;</code></dt>
 <dd>Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipsis. As absolute length it can be expressed in any unit allowed by the CSS {{cssxref("&lt;length&gt;")}} data type. 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>

<h3 id="Formal_syntax">Formal syntax</h3>

<pre class="syntaxbox">{{csssyntax}}</pre>

<h2 id="Examples">Examples</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th>Live example</th>
   <th>Code</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td style="padding: 1.5em;">
    <div style="background-color: lightgreen; border: solid 1px black; border-bottom-right-radius: 40px 40px; width: 100px; height: 100px;">
    <div style="display: none;">.</div>
    </div>
   </td>
   <td>An arc of circle is used as the border
    <pre class="brush: css">
div {
  border-bottom-right-radius: 40px 40px;
}
</pre>
   </td>
  </tr>
  <tr>
   <td style="padding: 1.5em;">
    <div style="background-color: lightgreen; border: solid 1px black; border-bottom-right-radius: 40px 20px; width: 100px; height: 100px;">
    <div style="display: none;">.</div>
    </div>
   </td>
   <td>An arc of ellipse is used as the border
    <pre class="brush: css">
div {
  border-bottom-right-radius: 40px 20px;
}
</pre>
   </td>
  </tr>
  <tr>
   <td style="padding: 1.5em;">
    <div style="background-color: lightgreen; border: solid 1px black; border-bottom-right-radius: 40%; width: 100px; height: 100px;">
    <div style="display: none;">.</div>
    </div>
   </td>
   <td>The box is a square: an arc of circle is used as the border
    <pre class="brush: css">
div {
  border-bottom-right-radius: 40%;
}
</pre>
   </td>
  </tr>
  <tr>
   <td style="padding: 1.5em;">
    <div style="background-color: lightgreen; border: solid 1px black; border-bottom-right-radius: 40%; width: 100px; height: 200px;">
    <div style="display: none;">.</div>
    </div>
   </td>
   <td>The box is not a square: an arc of ellipse is used as the border
    <pre class="brush: css">
div {
  border-bottom-right-radius: 40%;
}
</pre>
   </td>
  </tr>
  <tr>
   <td style="padding: 1.5em;">
    <div style="border: black 3px double; border-bottom-right-radius: 40%; height: 100px; width: 100px; background-color: rgb(250,20,70); background-clip: content-box;">
    <div style="display: none;">.</div>
    </div>
   </td>
   <td>The background color is clipped at the border
    <pre class="brush: css">
div {
  border-bottom-right-radius:40%;
  border-style: black 3px double;
  background-color: rgb(250,20,70);
  background-clip: content-box;
}
</pre>
   </td>
  </tr>
 </tbody>
</table>

<h2 id="Specifications">Specifications</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-bottom-right-radius', 'border-bottom-right-radius')}}</td>
   <td>{{Spec2('CSS3 Backgrounds')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Edge</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>1.0 {{property_prefix("-webkit")}}<br>
    4.0</td>
   <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}<br>
    {{CompatVersionUnknown}}</td>
   <td>1.0 (1.0){{property_prefix("-moz")}}<sup>[1]</sup><br>
    4.0 (2.0)<sup>[3]</sup></td>
   <td>9.0</td>
   <td>10.5</td>
   <td>3.0 (522){{property_prefix("-webkit")}}<br>
    5.0 (532.5)</td>
  </tr>
  <tr>
   <td>Percentages</td>
   <td>4.0</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>1.0 (1.0)<sup>[2]</sup><br>
    4.0 (2.0)</td>
   <td>9.0</td>
   <td>10.5</td>
   <td>5.0 (532.5)</td>
  </tr>
  <tr>
   <td>Elliptical corners</td>
   <td>1.0</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>3.5 (1.9.1)</td>
   <td>9.0</td>
   <td>10.5</td>
   <td>3.0 (522)</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Edge</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}<br>
    {{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}<sup>[3]</sup></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>Percentages</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>Elliptical corners</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] The prefixed version (allowed from Firefox 1 to Firefox 12) of this property uses a different name, <code>-moz-border-radius-bottomright</code>.</p>

<p>[2] Before Firefox 4, the {{cssxref("&lt;percentage&gt;")}} was relative to the width of the box even when specifying the radius for a height). This implied that <code>-moz-border-radius-bottomright</code> was always drawing an arc of circle, and never an ellipse, when followed by a single value.</p>

<p>[3] Prior to Gecko 50.0 {{geckoRelease("50.0")}}, border styles of rounded corners were always rendered as if <code>border-style</code> was <code>solid</code>. This has been fixed in Gecko 50.0.</p>

<p>In addition to the unprefixed support, Gecko 44.0 {{geckoRelease("44.0")}} added support for a <code>-webkit</code> prefixed version of the property for web compatibility reasons behind the preference <code>layout.css.prefixes.webkit</code>, defaulting to <code>false</code>. Since Gecko 49.0 {{geckoRelease("49.0")}} the preference defaults to <code>true</code>.</p>

<h2 id="See_also">See also</h2>

<p>The border-radius-related CSS properties: the CSS shorthand {{cssxref("border-radius")}}, the properties for the other corners: {{cssxref("border-top-right-radius")}}, {{cssxref("border-top-left-radius")}}, and {{cssxref("border-bottom-left-radius")}}.</p>