首页
找靠谱产品
找解决方案
找靠谱公司
找案例
找对的人
专家智库
悬赏任务
SAAS
ToB门户
了解全球最新的ToB事件
论坛
潜水/灌水快乐,沉淀知识,认识更多同行。
ToB圈子
加入IT圈,遇到更多同好之人。
微博
Follow
记录
Doing
博客
Blog
文库
业界最专业的IT文库,上传资料也可以赚钱
下载
分享
Share
排行榜
Ranklist
相册
Album
应用中心
qidao123.com ToB IT社区-企服评测·应用市场
»
论坛
›
软件与程序人生
›
前端开发
›
前端必知必会-CSS圆角
返回列表
发新帖
前端必知必会-CSS圆角
[复制链接]
发表于 2025-4-27 13:40:18
|
显示全部楼层
|
阅读模式
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要
登录
才可以下载或查看,没有账号?
立即注册
×
文章目录
CSS 圆角
CSS border-radius 属性
CSS border-radius - 指定每个角
CSS 圆角属性
总结
CSS 圆角
CSS 圆角
利用 CSS border-radius 属性,您可以为任何元素赋予“圆角”。
CSS border-radius 属性
CSS border-radius 属性定义元素角的半径。
提示:此属性答应您为元素添加圆角!
以下是三个示例:
具有指定背景颜色的元素的圆角:
具有边框的元素的圆角:
具有背景图像的元素的圆角:
以下是
代码
:
示例
#rcorners1 {
border-radius: 25px;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
#rcorners2 {
border-radius: 25px;
border: 2px solid #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
#rcorners3 {
border-radius: 25px;
background: url(paper.gif);
background-position: left top;
background-repeat: repeat;
padding: 20px;
width: 200px;
height: 150px;
}
复制
代码
提示:border-radius 属性现实上是 border-top-left-radius、border-top-right-radius、border-bottom-right-radius 和 border-bottom-left-radius 属性的简写属性。
CSS border-radius - 指定每个角
border-radius 属性可以有一到四个值。规则如下:
四个值 - border-radius: 15px 50px 30px 5px;(第一个值适用于左上角,第二个值适用于右上角,第三个值适用于右下角,第四个值适用于左下角):
三个值 - border-radius: 15px 50px 30px;(第一个值适用于左上角,第二个值适用于右上角和左下角,第三个值适用于右下角):
两个值 - border-radius: 15px 50px;(第一个值适用于左上角和右下角,第二个值适用于右上角和左下角):
一个值 - border-radius: 15px; (该值适用于所有四个角,它们的圆角相称:
代码
如下:
示例
#rcorners1 {
border-radius: 15px 50px 30px 5px;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
#rcorners2 {
border-radius: 15px 50px 30px;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
#rcorners3 {
border-radius: 15px 50px;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
#rcorners4 {
border-radius: 15px;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
复制代码
您还可以创建椭圆形角:
示例
#rcorners1 {
border-radius: 50px / 15px;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
#rcorners2 {
border-radius: 15px / 50px;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
#rcorners3 {
border-radius: 50%;
background: #73AD21;
padding: 20px;
width: 200px;
height: 150px;
}
复制代码
CSS 圆角属性
属性
描述
border-radius
用于设置所有四个 border-
-
-radius 属性的简写属性
border-top-left-radius
定义左上角边框的外形
border-top-right-radius
定义右上角边框的外形
border-bottom-right-radius
定义右下角边框的外形
border-bottom-left-radius
定义左下角边框的外形
总结
本文介绍了CSS圆角的利用,如有题目欢迎私信和评论
回复
使用道具
举报
返回列表
浏览过的版块
Oracle
分布式数据库
Java
物联网
数据仓库与分析
SQL-Server
ERP
SAAS
DevOps与敏捷开发
杀鸡焉用牛刀
+ 我要发帖
登录后关闭弹窗
登录参与点评抽奖 加入IT实名职场社区
去登录
微信订阅号
微信服务号
微信客服(加群)
H5
小程序
快速回复
返回顶部
返回列表