CSS border-start-end-radius 属性
定义和用法
border-start-end-radius
属性用于定义元素块方向起始处(block-start)和行内方向末尾(inline-end)之间的圆角半径。
注意:相关的 CSS 属性 writing-mode
、text-orientation
和 direction
定义了块方向和行内方向。这就是为什么这些属性也会影响 border-start-end-radius
属性的结果。对于英文页面,行内方向是从左到右,块方向是向下。
如果 border-start-end-radius
属性有两个值,则圆角将是一个椭圆:
border-start-end-radius: 50px 100px;
如果 border-start-end-radius
属性有一个值,则圆角将是一个圆形:
border-start-end-radius: 50px;
CSS border-start-end-radius
属性与 border-bottom-left-radius
、border-bottom-right-radius
、border-top-left-radius
和 border-top-right-radius
属性非常相似,但 border-start-end-radius
属性依赖于块方向和行内方向。
实例
例子 1
为某些元素的块方向起始处和行内方向末尾添加圆角:
#example1 { background-color: lightblue; border-start-end-radius: 50px; } #example2 { background-color: lightblue; border-start-end-radius: 50px 20px; } #example3 { background-color: lightblue; border-start-end-radius: 50%; direction: rtl; } #example4 { background-color: lightblue; border-start-end-radius: 50%; writing-mode: vertical-rl; }
例子 2:结合 direction 属性
块方向起始处和行内方向末尾的圆角位置受 direction
属性的影响:
#example1 { border: 2px solid red; direction: rtl; border-start-end-radius: 25px; }
例子 3:结合 writing-mode 属性
块方向起始处和行内方向末尾的圆角位置受 writing-mode
属性的影响:
#example2 { border: 2px solid red; writing-mode: vertical-rl; border-start-end-radius: 25px; }
CSS 语法
border-start-end-radius: 0|length|initial|inherit;
属性值
值 | 描述 |
---|---|
0 | 默认值。 |
length | 定义块方向起始处和行内方向末尾的圆角形状。请参阅:CSS 单位。 |
% | 定义圆角形状,以元素在对应轴上的长度的百分比。 |
initial | 将此属性设置为其默认值。参阅 initial。 |
inherit | 从其父元素继承此属性。参阅 inherit。 |
技术细节
默认值: | 0 |
---|---|
继承性: | 否 |
动画制作: | 支持。请参阅:动画相关属性。 |
版本: | CSS3 |
JavaScript 语法: | object.style.borderStartEndRadius="50px" |
浏览器支持
表格中的数字表示首个完全支持该属性的浏览器版本。
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
89.0 | 89.0 | 66.0 | 15.0 | 75.0 |
相关页面
教程:CSS 圆角
参考:CSS border-bottom-left-radius 属性
参考:CSS border-bottom-right-radius 属性
参考:CSS border-top-left-radius 属性