.pie {
width: 300px;
aspect-ratio: 1; // 设置宽高比
border-radius: 100%;
background: conic-gradient(red 0 30%, orange 30% 60%, yellow 60% 85%, blue 85% 100%); // 圆锥形渐变
display: flex;
align-items: center;
justify-content: center;
}
.pie > .inner {
width: 70%;
aspect-ratio: 1;
border-radius: 100%;
background-color: #fff;
}
.box {
width: 200px;
height: 200px;
border-radius: 50%;
background: conic-gradient(red 0deg 90deg, pink 90deg 180deg, yellow 180deg);
}
<body>
<!-- 环形 -->
<div class="pie">
<div class="inner"></div>
</div>
<!--饼图-->
<div class="box"></div>
</body>
CSS饼图/环形图
最新推荐文章于 2024-03-05 14:41:29 发布