border-top-right-radius
CSS
property rounds the top-right corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
The rounding can be a circle or an ellipse, or if one of the value is
0
no rounding is done and the corner is square.
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
background-clip
特性。
border-radius
shorthand property that is applied to the element after the
border-top-right-radius
CSS property, the value of this property is then reset to its initial value by the
shorthand property
.
/* the corner is a circle */ /* border-top-right-radius: radius */ border-top-right-radius: 3px; /* the corner is an ellipse */ /* border-top-right-radius: horizontal vertical */ border-top-right-radius: 0.5em 1em; border-top-right-radius: inherit;
With one value:
<length>
或
<percentage>
denoting the radius of the circle to use for the border in that corner.
With two values:
<length>
或
<percentage>
denoting the horizontal semi-major axis of the ellipse to use for the border in that corner.
<length>
或
<percentage>
denoting the vertical semi-major axis of the ellipse to use for the border in that corner.
<length-percentage>
<length>
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.
| 初始值 |
0
|
|---|---|
| 适用于 |
all elements; but User Agents are not required to apply to
table
and
inline-table
elements when
border-collapse
is
collapse
. The behavior on internal table elements is undefined for the moment.. It also applies to
::first-letter
.
|
| 继承 | no |
| 百分比 | refer to the corresponding dimension of the border box |
| 计算值 |
two absolute
<length>
s or
<percentage>
s
|
| 动画类型 | a length , percentage or calc(); |
<length-percentage>{1,2}where
<length-percentage> = <length> | <percentage>
| 实时范例 | 代码 |
|---|---|
An arc of circle is used as the border
div {
border-top-right-radius: 40px 40px;
}
|
|
An arc of ellipse is used as the border
div {
border-top-right-radius: 40px 20px;
}
|
|
The box is a square: an arc of circle is used as the border
div {
border-top-right-radius: 40%;
}
|
|
|
.
|
The box is not a square: an arc of ellipse is used as the border
div {
border-top-right-radius: 40%;
}
|
The background color is clipped at the border
div {
border-top-right-radius:40%;
border-style: black 3px double;
background-color: rgb(250,20,70);
background-clip: content-box;
}
|
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Backgrounds and Borders Module Level 3
The definition of 'border-top-right-radius' in that specification. |
候选推荐 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
border-top-right-radius
|
Chrome 完整支持 4 | Edge 完整支持 12 |
Firefox
完整支持
4
注意事项
|
IE 完整支持 9 | Opera 完整支持 10.5 | Safari 完整支持 5 | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 18 |
Firefox Android
完整支持
4
注意事项
|
Opera Android 完整支持 11 | Safari iOS 完整支持 4.2 | Samsung Internet Android 完整支持 1.0 |
| Elliptical corners | Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 3.5 | IE 完整支持 9 | Opera 完整支持 10.5 | Safari 完整支持 3 | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 18 | Firefox Android 完整支持 4 | Opera Android 完整支持 14 | Safari iOS 完整支持 1 | Samsung Internet Android 完整支持 1.0 |
| 百分比 | Chrome 完整支持 4 | Edge 完整支持 12 |
Firefox
完整支持
4
|
IE 完整支持 9 | Opera 完整支持 10.5 | Safari 完整支持 5 | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 18 | Firefox Android 完整支持 4 | Opera Android 完整支持 14 | Safari iOS 完整支持 4.2 | Samsung Internet Android 完整支持 1.0 |
完整支持
见实现注意事项。
用户必须明确启用此特征。
使用非标名称。
要求使用供应商前缀或不同名称。
border-radius
shorthand property
border-bottom-right-radius
,
border-bottom-left-radius
, and
border-top-left-radius
background
background-attachment
background-clip
background-color
background-image
background-origin
background-position
background-position-x
background-position-y
background-repeat
background-size
border
border-bottom
border-bottom-color
border-bottom-left-radius
border-bottom-right-radius
border-bottom-style
border-bottom-width
border-color
border-image
border-image-outset
border-image-repeat
border-image-slice
border-image-source
border-image-width
border-left
border-left-color
border-left-style
border-left-width
border-radius
border-right
border-right-color
border-right-style
border-right-width
border-style
border-top
border-top-color
border-top-left-radius
border-top-right-radius
border-top-style
border-top-width
border-width
box-shadow