当前位置:网站首页>你以为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;
}
边栏推荐
- The video of machine learning to learn [update]
- 10 Convolutional Neural Networks for Deep Learning 3
- DataTable使用Linq进行分组汇总,将Linq结果集转化为DataTable
- 【流程图】
- [Skill] Using Sentinel to achieve priority processing of requests
- How to systematically plan and learn software testing?
- Converts XML tags to TXT format (voc conversion for yolo convenient training)
- PL/SQL Some Advanced Fundamental
- centos 安装postgresql13 指定版本
- 8. Haproxy builds a web cluster
猜你喜欢

将xml标签转换为txt(voc格式转换为yolo方便进行训练)

文件系统的简单操作

【云原生--Kubernetes】Pod资源管理与探针检测

Simple operation of the file system

42. 接雨水

Enterprise live broadcast is on the rise: Witnessing focused products, micro-like embracing ecology

System design. How to design a spike system (full version transfer)
![The video of machine learning to learn [update]](/img/e7/c9a17b4816ce8d4b0787c451520ac3.png)
The video of machine learning to learn [update]

系统设计.秒杀系统

There is an 8 hour difference between the docker installation of mysql and the host.
随机推荐
drools from download to postman request success
10 Convolutional Neural Networks for Deep Learning 3
【21 Days Learning Challenge】Direct Insertion Sort
2003. 每棵子树内缺失的最小基因值 DFS
嵌入式数据库开发编程MySQL(全)
7-3 LVS+Keepalived Cluster Description and Deployment
go module的介绍与应用
关于yolo7和gpu
share总结
XSS related knowledge points
SQL interview Questions
How to open a CITIC Securities online account?is it safe?
JVM Notes
C专家编程 第5章 对链接的思考 5.3 函数库链接的5个特殊秘密
【SemiDrive源码分析】【MailBox核间通信】47 - 分析RPMSG_IPCC_RPC 方式 单次传输的极限大小 及 极限带宽测试
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.2 我的代码为什么无法运行
类如何只能静态分配和只能动态分配
结构体函数练习
unity框架之缓存池
drools从下载到postman请求成功