使用从alpha到颜色的CSS3线性渐变

时间:2013-03-04 01:49:21

标签: css css3 gradient linear-gradients

我正在寻找一种从“无”(alpha)到定义颜色的线性渐变的方法:#e6a015。我在谷歌和这里都找不到它,有人可以告诉我该怎么做吗?

1 个答案:

答案 0 :(得分:1)

你可以使用rgba颜色,alpha为零

background-image: -ms-linear-gradient(top left, rgba(230,160,21,0) 0%, rgb(230,160,21)  100%);

/* Mozilla Firefox */ 
background-image: -moz-linear-gradient(top left, rgba(230,160,21,0) 0%, rgb(230,160,21) 100%);

/* Opera */ 
background-image: -o-linear-gradient(top left, rgba(230,160,21,0) 0%, rgb(230,160,21) 100%);

/* Webkit (Safari/Chrome 10) */ 
background-image: -webkit-gradient(linear, left top, right bottom, color-stop(0, rgba(230,160,21,0)), color-stop(1, rgb(230,160,21)));

/* Webkit (Chrome 11+) */ 
background-image: -webkit-linear-gradient(top left, rgba(230,160,21,0) 0%,rgb(230,160,21) 100%);

/* W3C Markup, IE10 Release Preview */ 
background-image: linear-gradient(to bottom right, rgba(230,160,21,0) 0%, rgb(230,160,21) 100%);

DEMO