css实现一个扇形图表效果代码
代码语言:html
所属分类:图表
代码描述:css实现一个扇形图表效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
background: #1F2428;
text-align: center;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
flex-wrap: wrap;
box-sizing: border-box;
height: 100vh;
padding: 30px;
}
.margin {
margin: 25px;
}
.semi-donut {
--percentage: 0;
--fill: #ff0;
width: 300px;
height: 150px;
position: relative;
color: #fff;
font-size: 22px;
font-weight: 600;
overflow: hidden;
color: var(--fill);
display: flex;
align-items: flex-end;
justify-content: center;
box-sizing: border-box;
}
.semi-donut:after {
content: "";
width: 300px;
height: 300px;
border: 50px solid;
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) var(--fill) var(--fill);
position: absolute;
border-radius: 50%;
left: 0;
top: 0;
box-sizing: border-box;
transform: rotate(calc( 1deg * ( -45 + var(--percentage) * 1.8 ) ));
-webkit-animation: fillAnimation 1s ease-in;
animation: fillAnimation 1s ease-in;
}
.semi-donut-model-2 {
width: 300px;
height: 150px;
position: relative;
text-align: center;
color: #fff;
font-size: 22px;
font-weight: 600;
border-radius: 150px 150px 0 0;
overflow: hidden;
color: var(--fill);
display: flex;
align-items: flex-end;
justify-content: center;
box-sizing: border-box;
}
.semi-donut-model-2:before, .semi-donut-model-2:after {
content: "";
width: 300px;
height: 150px;
border: 50px solid var(--fill);
border-top: none;
position:.........完整代码请登录后点击上方下载按钮下载查看
网友评论0