如果只要求兼容高级浏览器,CSS3可以解决。
.box{width:500px;height:100px;background-image: -moz-linear-gradient(top , #45B5DA, #0382AD);background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, from(#45B5DA), to(#0382AD));background-image: -o-linear-gradient(top , #45B5DA, #0382AD);}如果要兼容低级浏览器,例如凯答瞎IE6,还是用背景图片重复吧。举数
上面的这属性可以盯空在CSS手册里查到。
可以使用 background-image 属性并指定 linear-gradient 函数。
比如想为文本添加从红色到蓝咐族色的渐变告陪色:.text {
background-image: linear-gradient(to right, red, blue);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}另外,还可袜简蠢以使用其他函数,例如 radial-gradient,以创建径向渐变。
希望这可以帮到你。
CSS3 定义了两种类型掘顷散的渐变(gradients):线性渐变(Linear Gradients)- 向下/向上/向左/向右/对判氏角方向
语乎老法:background-image: linear-gradient(direction, color-stop1, color-stop2, ...);
径向渐变(Radial Gradients)- 由它们的中心定义
语法:background-image: linear-gradient(angle, color-stop1, color-stop2);
以上就是土嘎嘎小编大虾米为大家整理的css3渐变使用什么属性_css里怎么将字体加渐变颜色?相关主题介绍,如果您觉得小编更新的文章对您有所帮助,不要忘记讲本站分享给您身边的朋友哦!!