
css实现圆环效果有多种方法,这里为大家分享五种方法:
(推荐教程:CSS教程)
首先我们来看一下实现效果:

立即学习“前端免费学习笔记(深入)”;
接下来为大家介绍方法:
1、两个标签的嵌套
.element1{
width: 200px;
height: 200px;
background-color: lightpink;
border-radius: 50%;
}
.child1{
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #009966;
position: relative;
top: 50px;
left: 50px;
}2、使用伪元素,before/after
.element2{
width: 200px;
height: 200px;
background-color: lightpink;
border-radius: 50%;
}
.element2:after{
content: "";
display: block;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #009966;
position: relative;
top: 50px;
left: 50px;
}3、使用border:
.element3{
width: 100px;
height: 100px;
background-color: #009966;
border-radius: 50%;
border: 50px solid lightpink ;
}(学习视频推荐:css视频教程)
4、使用border-shadow
.element4{
width: 100px;
height: 100px;
background-color: #009966;
border-radius: 50%;
box-shadow: 0 0 0 50px lightpink ;
margin: auto;
}.element5{ width: 200px; height: 200px; background-color: #009966; border-radius: 50%; box-shadow: 0 0 0 50px lightpink inset; margin: auto; }5、使用radial-gradient
.element6{ width: 200px; height: 200px; border-radius: 50%; background: -webkit-radial-gradient( circle closest-side,#009966 50%,lightpink 50%); }相关文章
css 想制作导航栏悬浮下拉效果怎么办_hover 与 position absolute 配合
css 过渡与阴影变化_控制 box-shadow 的动态效果
css 想让弹性盒子间距自动分配怎么办_justify-content space-between 使用
css flexbox布局与动态高度_如何使项目自适应容器高度
css 想制作按钮悬停效果怎么办_hover 与 background-color 配合
本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
更多热门AI工具










