css渐变

1、linear-gradient 线性渐变

background-image: linear-gradient(direction, colorOne, colorTwo, ...);

direction:角度或者方向,90deg或to left这种,如下例子

/* 从上到下,蓝色渐变到红色 */
linear-gradient(blue, red);
 
/* 渐变轴为45度,从蓝色渐变到红色 */
linear-gradient(45deg, blue, red);
 
/* 从右下到左上、从蓝色渐变到红色 */
linear-gradient(to left top, blue, red);
 
/* 从下到上,从蓝色开始渐变、到高度40%位置是绿色渐变开始、最后以红色结束 */
linear-gradient(0deg, blue, green 40%, red);

2、radial-gradient径向渐变

background-image: radial-gradient(shape size at position, start-color, ..., last-color);

shape:圆类型:ellipse(椭圆)、circle(圆)

size:渐变的大小:farthest-corner (默认) 、closest-side 、closest-corner 、farthest-side

position:位置:to、center、bottom

background-image: radial-gradient(circle closest-side at 60% 55%,red 5%, green 15%, blue 60%);

3、repatiing-linear-gradient重复渐变背景

background: repeating-linear-gradient(angle | to side-or-corner,colorOnw, colorTwo, ...);

例:

background-image: repeating-linear-gradient(45deg, red, blue 7%, green 10%);

4、repeating-radial-gradient重复径向渐变

background-image: repeating-radial-gradient(shape size at position, start-color, ..., last-color);

例:

background-image: repeating-radial-gradient(red, yellow 10%, green 15%);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值