奇怪的知识又增加了 ☞ 用css画一个饼图(conic-gradient)

conic-gradient 是啥

以下是mdn原文

The conic-gradient() CSS function creates an image consisting of a gradient with color transitions rotated around a center point (rather than radiating from the center). Example conic gradients include pie charts and color wheels. The result of the conic-gradient() function is an object of the data type, which is a special kind of .

大概意思 就是锥形渐变 返回值是一种特殊的图片格式

兼容性不好 😌 没关系 好玩就可以了
在这里插入图片描述

奇奇怪怪的画出一个饼图 😜

在这里插入图片描述

	.piegraph {
	    display: inline-block;
	    width: 500px;
	    height: 500px;
	    border-radius: 50%;
	    background-image: conic-gradient(yellow 0,red 90deg,blue 180deg,green 270deg,yellow 360deg);
	  }

在这里插入图片描述

.piegraph {
    display: inline-block;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background-image: conic-gradient(yellow 0 90deg,red 90deg 180deg,blue 180deg 270deg,green 270deg 360deg);
  }

在这里插入图片描述


.piegraph {
    display: inline-block;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background-image: conic-gradient(from 0 at 25% 25% , yellow 0 90deg ,red 90deg 180deg,blue 180deg 270deg,green 270deg 360deg);
  }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值