CSS | 边界半径属性 (CSS | border-radius Property)

The border-radius property is commonly used to convert box elements into circles. We can convert box elements into the circle element by setting the border-radius to half of the length of a square element.

border-radius属性通常用于将框元素转换为圆形。 通过将边框半径设置为正方形元素长度的一半,我们可以将框元素转换为圆形元素。

Syntax:

句法:

Element {Width: 150px;
Height: 150px;
border-radius: 50%;
}

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
p {background: #73AD21;
width: 200px;
height: 150px;
border-radius: 50%
}
</style>
</head>
<body>
<h1>CSS Rounded Corners</h1>
<p></p>
</body>
</html>

Output

输出量

In the above example, 50% border-radius is applied to all the corners.

在上面的示例中,将50%的边界半径应用于所有角。

1)具有一个值的border-radius属性 (1) border-radius property with one value)

The property takes a single value to the border-radius and that value is applied to all the four corners and the corners are rounded equally.

该属性对边界半径采用单个值,并且该值应用于所有四个角,并且这些角均等地舍入。

Syntax:

句法:

Element {border-radius: 15px;
}

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
div {border: 2px solid red;
padding: 10px;
border-radius: 25px;
}
</style>
</head>
<body>
<div>
<p>Border Radius in CSS</p>
</div>
</body>
</html>

Output

输出量

In the above example, the border-radius of 25px is applied to all four sides equally.

在上面的示例中, 边界半径 25px均等地应用于所有四个侧面。

2)具有两个值的border-radius属性 (2) border-radius property with two values)

This property takes two values to the border-radius. The first value is applied to top-left and bottom-right corners, the second value is applied to top-right and bottom-left corners.

此属性将border-radius取两个值。 第一个值应用于左上角和右下角 ,第二个值应用于右上角和左下角 。

Syntax:

句法:

Element {border-radius: 15px 10px;
}

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
div {border: 2px solid red;
padding: 10px;
border-radius: 60px 30px;
}
</style>
</head>
<body>
<div>
<p>Border Radius in CSS</p>
</div>
</body>
</html>

Output

输出量

In the above example, the border-radius of 60px is applied to top-left and bottom-right and 30px is applied to top-right and bottom-left corners.

在上面的示例中, 边框半径 60px应用于左上角和右下角,而30px应用于右上角和左下角 。

3)具有三个值的border-radius属性 (3) border-radius property with three values)

This property takes three values to the border-radius. The first value is applied to the top-left corner and the second value is applied to top-right and bottom-left corners, and the third value is applied to the bottom-right corner.

该属性将border-radius取三个值。 所述第一值被施加到左上角和所述第二值被施加到右上和左下的角,并且所述第三值被施加到右下角 。

Syntax:

句法:

Element {border-radius: 15px 10px 30px;
}

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
div {border: 2px solid green;
padding: 10px;
border-radius: 60px 30px 20px;
}
</style>
</head>
<body>
<div>
<p>Border Radius in CSS</p>
</div>
</body>
</html>

Output

输出量

In the above example, border-radius of 60px is applied to top-left corner, 30px is applied to top-right and bottom-left corners and 20px is applied to bottom-right corner.

在上面的例子中,60像素 边界半径被施加到左上角 ,30像素被施加到右上和左下的角和20像素被施加到右下角 。

4)具有四个值的border-radius属性 (4) border-radius property with four values)

This property takes four values to the border-radius and applies four different values to each of the corners. The first value is applied to the top-left corner, the second value is applied to the top-right corner, the third value is applied to the bottom-right corner and the fourth value is applied to the bottom-left corner.

此属性将四个值应用于边界半径 ,并将四个不同的值应用于每个角。 所述第一值被施加到左上角 ,第二值被施加到右上角 ,第三值被施加到右下角和第四值被施加到左下角 。

Syntax:

句法:

Element {border-radius: 15px 10px 20px 5px;
}

Example:

例:

<!DOCTYPE html>
<html>
<head>
<style>
div {border: 2px solid green;
padding: 10px;
border-radius: 60px 30px 50px 10px;
}
</style>
</head>
<body>
<div>
<p>Border Radius in CSS</p>
</div>
</body>
</html>

Output

输出量

In the above example, 60px is applied to top-left corner, 30px is applied to the top-right corner, 50px is applied to bottom-right corner and 10px is applied to bottom-left corner of the box.

在上述例子中,60像素被施加到左上角 ,30像素被施加到右上角 ,50像素被施加到右下角和10px的被施加到盒的左下角 。

翻译自: https://www.includehelp.com/code-snippets/the-border-radius-property-in-css.aspx

CSS中的border-radius属性相关推荐

  1. [css] css中的border:none和border:0px有什么区别?

    [css] css中的border:none和border:0px有什么区别? none是没有边框. 0px是边框的宽度为0px. 个人简介 我是歌谣,欢迎和大家一起交流前后端知识.放弃很容易, 但坚 ...

  2. [css] css中的选择器、属性、属性值区分大小写吗?

    [css] css中的选择器.属性.属性值区分大小写吗? 选择器和属性区分大小写,属性值如果是颜色可以不区分大小写吧 个人简介 我是歌谣,欢迎和大家一起交流前后端知识.放弃很容易, 但坚持一定很酷.欢 ...

  3. 妙味css3课程---1-1、css中自定义属性可以用属性选择器么

    妙味css3课程---1-1.css中自定义属性可以用属性选择器么 一.总结 一句话总结:可以的. 1.如何实现用属性选择器实现a标签根据href里面含有的字段选择背景图片? p a[href*=te ...

  4. css中reset属性详解,css中如何使用counter-reset属性

    css中如何使用counter-reset属性 发布时间:2020-09-23 14:26:58 来源:亿速云 阅读:83 作者:小新 这篇文章主要介绍css中如何使用counter-reset属性, ...

  5. CSS中内容的剪切属性clip

    1. 在CSS中,可以使用剪切属性对元素内容的可视化区域进行控制,剪切区域所使用的属性时clip属性, 用来裁剪元素的可视化区域,内容的剪切属性可以使用2种属性值,一种为auto值,另一种为区域值,语 ...

  6. css中字体与段落属性设置/文本高级样式

    CSS中字体与段落属性 毫无疑问,不管什么网站,文字一定是必不可少.文字可以是网页传播信息的主要手段.那么怎么显示文字,才能更加的美观,那么大家需要了解以下文字属性. 字体属性 属性 用途 语法(一些 ...

  7. php中li标签,li标签有哪些属性?css中li标签的属性详解

    在html中,我们经常会遇到li标签,那么li标签有哪些属性?下面我们来了解一下css中li标签的属性. 一:标签有哪些属性 在html中,使用css中li标签来控制样式,很多网站上都是点为开头,也有 ...

  8. html cellpadding css,CSS中cellspacing和cellpadding属性用法

    CSS中cellspacing和cellpadding属性的使用是否了解,这里和大家分享一下,cellspacing属性设置表格边框之间和表格单元格之间的间距(以像素为单位):cellpadding属 ...

  9. css中的 type,css中如何使用list-style-type属性

    css中如何使用list-style-type属性 发布时间:2020-09-24 10:05:15 来源:亿速云 阅读:88 作者:小新 小编给大家分享一下css中如何使用list-style-ty ...

  10. 如何使用CSS3 Border Radius属性

    With CSS3, you can give any element "rounded corners" by using the border-radius property. ...

最新文章

  1. 商汤提基于贪心超网络的One-Shot NAS,达到最新SOTA | CVPR 2020
  2. 关于ewebeditor行距
  3. Django中url匹配规则的补充
  4. Linq to XML的练习
  5. JavaScript(ES6)传播算子和rest参数简介
  6. net.sf.ezmorph.bean.MorphDynaBean cannot be cast to com.console.demo.web.model.XXX
  7. java对象拷贝——PropertyUtils copyProperties 用法和性能
  8. 怎么将ts文件快速合成一个文件
  9. H264 SPS分析
  10. CGAL学习记录——点云密度计算
  11. 伺服控制的三环控制原理及整定仿真和Simulink模型
  12. slidebox使用教程 设定焦点数量
  13. HDU-6396-Swordsman(文件输入+优先队列)
  14. 文明IV模组(MOD)制作指南
  15. 庆祝自己喜提ROG冰刃3新锐!
  16. Python(x,y)下载安装及基本操作
  17. Ubuntu图形界面下命令行窗口打开快捷键创建
  18. Revit建模弹窗警告:图元稍微偏离了轴,可能会导致不精确
  19. 马化腾:我和太太也是QQ认识的
  20. 印度为何能频频培养出全球顶尖的程序员?

热门文章

  1. jexboss工具 -- JBOSS未授权访问漏洞利用
  2. 箱式图 添加异常值平均值_什么是脏数据?怎样用箱形图分析异常值?终于有人讲明白了...
  3. uni-app微信获取手机号,第一次解密总是失败
  4. CSS布局的三个关键属性:float、position、display
  5. inheritPrototypal.js
  6. 如何用纯 CSS 创作一个冒着热气的咖啡杯
  7. vue 导出html
  8. Java基础知识(数据类型和集合)
  9. echarts折线图相关
  10. jackson - @JsonProperty的使用