这篇文章给大家分享一个用css3实现环形渐变进度条的内容,也就是给环形进度条添加渐变的效果,实现效果如下。那么这个效果具体怎样做呢?本文有实现思路及代码,接下来我们就详细来看看吧。
实现思路
如图所示:

注意到的属性:
下面代码是绘制 33%的圆
<div class="circle-bar">
<div class="circle-bar-left"></div>
<div class="circle-bar-right"></div>
<div class="mask">
<span class="percent">33%</span>
</div>
</div>
.circle-bar {
background-image: linear-gradient(#7affaf, #7a88ff);
width: 182px;
height: 182px;
position: relative;
}
.circle-bar-left {
background-color: #e9ecef;
width: 182px;
height: 182px;
clip: rect(0, 91px, auto, 0);
}
.circle-bar-right {
background-color: #e9ecef;
width: 182px;
height: 182px;
clip: rect(0, auto, auto, 91px);
transform: rotate(118.8deg);
}
.mask {
width: 140px;
height: 140px;
background-color: #fff;
text-align: center;
line-height: 0.2em;
color: rgba(0, 0, 0, 0.5);
position: absolute;
left: 21px;
top: 21px;
}
.mask > span {
display: block;
font-size: 44px;
line-height: 150px;
}
/*所有的后代都水平垂直居中,这样就是同心圆了*/
.circle-bar * {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
/*自身以及子元素都是圆*/
.circle-bar,
.circle-bar > * {
border-radius: 50%;
}
关于css3环形渐变进度条的实现就介绍到这,上述实例具有一定的借鉴价值,感兴趣的朋友可以参考,希望能对大家有帮助,想要了解更多大家可以关注群英网络其它相关文章。
文本转载自脚本之家
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
长按识别二维码并关注微信
更方便到期提醒、手机管理