目录

CSS border-top-left-radius 属性


示例

将圆角边框添加到两个 <div> 元素的左上角:

#example1 {
  border: 2px solid red;
  border-top-left-radius: 25px;
}

#example2 {
  border: 2px solid red;
  border-top-left-radius: 50px 20px;
}
亲自试一试 »

下面有更多 "亲自试一试" 示例。


定义和用法

这个border-top-left-radius属性定义左上角的半径。

提示:此属性允许您为元素添加圆角边框!

展示演示❯

默认值: 0
遗传:
可动画: 是的。阅读可动画的尝试一下
版本: CSS3
JavaScript 语法: 对象.style.borderTopLeftRadius="25px"尝试一下

浏览器支持

表中的数字指定完全支持该属性的第一个浏览器版本。

后跟 -webkit- 或 -moz- 的数字指定使用前缀的第一个版本。

Property
border-top-left-radius 5.0
4.0 -webkit-
9.0 4.0
3.0 -moz-
5.0
3.1 -webkit-
10.5


CSS 语法

border-top-left-radius: length| % [ length| %]|initial|inherit;

笔记:如果设置两个值,第一个值用于上边框,第二个值用于左边框。如果省略第二个值,则从第一个值复制。如果任一长度为零,则角为方形,而不是圆形。

属性值

Value Description Demo
length Defines the shape of the top-left corner. Read about length units Demo ❯
% Defines the shape of the top-left corner in % Demo ❯
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

更多示例

示例

以百分比形式向左上角添加圆角边框:

#example1 {
  border: 2px solid red;
  background: url(paper.gif);
  padding: 10px;
  border-top-left-radius: 40%;
}
亲自试一试 »

相关页面

CSS教程:CSS 圆角

HTML DOM 参考:borderTopLeftRadius 属性