python渐变色背景生成动态代码_【CSS3】背景渐变色代码

本文介绍了如何使用CSS3创建各种方向和样式的背景渐变效果,包括从上到下、从左到右、从左上到右下、使用角度、多种颜色节点、使用透明度以及径向渐变的实现方法,详细展示了不同渐变类型的代码示例。
摘要由CSDN通过智能技术生成

从上到下

#grad{background:-webkit-linear-gradient(red, blue);background:-o-linear-gradient(red, blue);background:-moz-linear-gradient(red, blue);background:linear-gradient(red, blue);

}从左到右

#grad{background:-webkit-linear-gradient(left, red , blue);background:-o-linear-gradient(right, red, blue);background:-moz-linear-gradient(right, red, blue);background:linear-gradient(to right, red , blue);

}从左上到右下

#grad{background:-webkit-linear-gradient(left top, red , blue);background:-o-linear-gradient(bottom right, red, blue);background:-moz-linear-gradient(bottom right, red, blue);background:linear-gradient(to bottom right, red , blue);

}使用角度

#grad{background:-webkit-linear-gradient(180deg, red, blue);background:-o-linear-gradient(180deg, red, blue);background:-moz-linear-gradient(180deg, red, blue);background:linear-gradient(180deg, red, blue);

}多种颜色节点

#grad{background:-webkit-linear-gradient(left,red,orange,yellow,green,blue,indigo,violet);background:-o-linear-gradient(left,red,orange,yellow,green,blue,indigo,violet);background:-moz-linear-gradient(left,red,orange,yellow,green,blue,indigo,violet);background:linear-gradient(to right, red,orange,yellow,green,blue,indigo,violet);

}使用透明度

#grad{background:-webkit-linear-gradient(left,rgba(255,0,0,0),rgba(255,0,0,1));background:-o-linear-gradient(right,rgba(255,0,0,0),rgba(255,0,0,1));background:-moz-linear-gradient(right,rgba(255,0,0,0),rgba(255,0,0,1));background:linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1));

}径向渐变

#grad{background:-webkit-radial-gradient(red, green, blue);background:-o-radial-gradient(red, green, blue);background:-moz-radial-gradient(red, green, blue);background:radial-gradient(red, green, blue);

}形状为圆形的径向渐变

#grad{background:-webkit-radial-gradient(circle, red, yellow, green);background:-o-radial-gradient(circle, red, yellow, green);background:-moz-radial-gradient(circle, red, yellow, green);background:radial-gradient(circle, red, yellow, green);

}颜色不均匀的径向渐变

#grad{background:-webkit-radial-gradient(red 5%, green 15%, blue 60%);background:-o-radial-gradient(red 5%, green 15%, blue 60%);background:-moz-radial-gradient(red 5%, green 15%, blue 60%);background:radial-gradient(red 5%, green 15%, blue 60%);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值