css径向渐变

CSS radial-gradient() 函数创建一个,用来展示由原点(渐变中心)辐射开的颜色渐变。

  • 默认均匀分布
#test{
				width: 200px;
				height: 300px;
				background-image: radial-gradient(red,blue);
			}

在这里插入图片描述

  • 不均匀分布:
    radial-gradnent(circle,red,blue)
    改变渐变的形状:
    circle
    ellipse(默认为椭圆)
#test{
				width: 200px;
				height: 300px;
				background-image: radial-gradient(circle,red,blue);
			}

在这里插入图片描述

  • 描述边缘轮廓的具体位置:
    radial-grandient(closest-corner circle,red,blue)
    closest-side 最近边
    渐变的边缘形状与容器距离渐变中心点最近的一边相切(圆形)或者至少与距离渐变中心点最近的垂直和水平边相切(椭圆)
    farthest-side 最远边
    与closest-side相反,边缘形状与容器距离渐变中心点最远的一边相切(或最远的垂直和水平边)。
    closest-corner 最近角
    渐变的边缘形状与容器距离渐变中心点最近的一个角相交。
    farthest-corner 最远角
    渐变的边缘形状与容器距离渐变中心点最远的一个角相交。
#test{
				width: 200px;
				height: 300px;
				background-image: radial-gradient(closest-side circle,red,blue 50%);/*渐变边缘距离最近一边是中心点距离最近一边的的50%*/
			}
			#test1{
				margin-top: 10px;
				width: 200px;
				height: 300px;
				background-image: radial-gradient(farthest-side circle,red,blue 50%);/*渐变边缘距离最远一边是中心点距离最远一边的的50%*/
			}

在这里插入图片描述

#test2{
				margin-top: 10px;
				width: 200px;
				height: 300px;
				background-image: radial-gradient(closest-corner circle,red,blue 50%);
			}
			#test3{
				margin-top: 10px;
				width: 200px;
				height: 300px;
				background-image: radial-gradient(farthest-corner circle,red,blue 50%);
			}
			

在这里插入图片描述

改变中心点:

#test2{
				margin-top: 10px;
				width: 200px;
				height: 300px;
				background-image: radial-gradient(closest-corner circle at 50px 50px,red,blue 50%);/*中心点位置在50px 50px*/
			}
			#test3{
				margin-top: 10px;
				width: 200px;
				height: 300px;
				background-image: radial-gradient(farthest-corner circle at 50px 50px,red,blue 50%);
			}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值