当前位置:网站首页>你以为border-radius只是圆角吗?【各种角度】
你以为border-radius只是圆角吗?【各种角度】
2022-08-04 04:45:00 【火兰】
border-radius,国内翻译成圆角,你可能以为这个属性就是用来画圆角,没错,但是除此之外,它还可以做点别的事情。
radius其实指的是边框所在圆的半径,这个CSS3属性不仅能够创建圆角,还可以创建椭圆角(如下图),把这些角按照不同的顺序和大小来展现,能够绘制成多种多样的图形。以下图例就是通过定义border-radius得到的效果。
主要在于要理解水平半径和垂直半径:有斜杠,则斜杠前表示水平半径长度,斜杠后表示垂直半径高度;无斜杠,表示水平半径和垂直半径一样。
div{
margin:100px auto;
width:400px;
height:200px;
border-radius:200px/100px;
background:red;
}

border-radius可以通过值来定义样式相同的角,也对每个角分别定义。下面的表格解释了各个写法所表示的效果。
1、border-radius:100px 将创建四个大小一样的圆角
div{
margin:100px auto;
width:200px;
height:200px;
border-radius:100px;
background:red;
}2、border-radius:100px 150px 100px 50px; 四个值分别表示左上角、右上角、右下角、左下角。
四个值分别表示四个角的半径(水平和垂直半径一样)
div{
margin:100px auto;
width:200px;
height:200px;
border-radius:100px 150px 100px 50px;
background:red;
}
3、border-radius:100px 150px; 第一个值表示左上角、右下角;第二个值表示右上角、左下角。
div{
margin:100px auto;
width:200px;
height:200px;
border-radius:100px 50px;
background:red;
}
4、border-radius:100px 150px 50px; 第一个值表示左上角;第二个值表示右上角、左下角;第三个值表示右下角。
div{
margin:100px auto;
width:200px;
height:200px;
border-radius:100px 150px 50px;
background:red;
}

5、border-radius:20px 40px 40px 80px/10px 30px 50px70px; 斜杠前面的一组四个值分别表示四个角的水平半径;斜杠后面的一组四个值分别表示四个角的垂直半径。
div{
margin:100px auto;
width:200px;
height:200px;
border-radius:20px 40px 60px 80px/10px 30px 50px 70px;
background:red;
}
6、border-radius:10px 20px 40px/20px 50px 斜杠前面和后面每一组分别表示的是四个角水平半径和四个角垂直半径。两个值、三个值的顺序规则你懂的哈,跟上面一样的
div{
margin:100px auto;
width:200px;
height:200px;
border-radius:10px 20px 40px/20px 50px;
background:red;
}
边栏推荐
- 8. Haproxy builds a web cluster
- Turn: Management is the love of possibility, and managers must have the courage to break into the unknown
- 7-3 LVS+Keepalived Cluster Description and Deployment
- 8.Haproxy 搭建Web集群
- There is an 8 hour difference between the docker installation of mysql and the host.
- 帮助企业实现数字化转型成功的八项指导原则
- if,case,for,while
- day13--postman接口测试
- 看DevExpress丰富图表样式,如何为基金公司业务创新赋能
- 如何动态添加script依赖的脚本
猜你喜欢

7-3 LVS+Keepalived Cluster Description and Deployment

See how DevExpress enriches chart styles and how it empowers fund companies to innovate their business

7-3 LVS+Keepalived集群叙述与部署

八年软件测试工程师带你了解-测试岗进阶之路

if,case,for,while

【评价类模型】Topsis法(优劣解距离法)
![[C language advanced] program environment and preprocessing](/img/ac/a13dd2cc47136d4938b6fc7fad660c.png)
[C language advanced] program environment and preprocessing

七夕节,我用代码制作了表白信封

Learn iframes and use them to solve cross-domain problems

系统设计.秒杀系统
随机推荐
[C language advanced] program environment and preprocessing
OpenGL绘制圆
This Thursday evening at 19:00, the fourth live broadcast of knowledge empowerment丨The realization of equipment control of OpenHarmony smart home project
【一步到位】Jenkins的安装、部署、启动(完整教程)
系统设计.如何设计一个秒杀系统(完整版 转)
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.1 数组并非指针
将xml标签转换为txt(voc格式转换为yolo方便进行训练)
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.4 使声明与定义相匹配
How to automatically export or capture abnormal login ip and logs in elastic to the database?
【评价类模型】Topsis法(优劣解距离法)
[Ryerson emotional speaking/singing audiovisual dataset (RAVDESS)]
结构体指针知识要点总结
leetcode 12. 整数转罗马数字
七夕节,我用代码制作了表白信封
软件测试如何系统规划学习呢?
drools从下载到postman请求成功
SQL query String field less than 10 how to check
【id类型和NSObject指针 ObjectIve-C中】
3000字,一文带你搞懂机器学习!
How class only static allocation and dynamic allocation