线性渐变无法在IE或Firefox中使用

时间:2013-09-27 15:15:59

标签: css gradient linear-gradients

我读到语法已更新以删除前缀,但我尝试了以下所有内容,但没有一个正在运行:

  background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#82dc7b), to(#61a45c));
        -webkit-linear-gradient(top, #82dc7b, #61a45c);
        -moz-linear-gradient(top, #82dc7b, #61a45c);
        -ms-linear-gradient(top, #82dc7b, #61a45c);
        -o-linear-gradient(top, #82dc7b, #61a45c);
        linear-gradient(to bottom, #82dc7b, #61a45c);

2 个答案:

答案 0 :(得分:2)

这样的事情怎么样?

background: #82dc7b; /* Old browsers */
background: -moz-linear-gradient(top,  #82dc7b 0%, #61a45c 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#82dc7b), color-stop(100%,#61a45c)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #82dc7b 0%,#61a45c 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #82dc7b 0%,#61a45c 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #82dc7b 0%,#61a45c 100%); /* IE10+ */
background: linear-gradient(to bottom,  #82dc7b 0%,#61a45c 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#82dc7b', endColorstr='#61a45c',GradientType=0 ); /* IE6-9 */

请查看以下资源以获取帮助:http://www.colorzilla.com/gradient-editor/

答案 1 :(得分:1)

试试这个:

background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#82dc7b), to(#61a45c));
background: -webkit-linear-gradient(top, #82dc7b, #61a45c);
background: -moz-linear-gradient(top, #82dc7b, #61a45c);
background: -ms-linear-gradient(top, #82dc7b, #61a45c);
background: -o-linear-gradient(top, #82dc7b, #61a45c);
background: linear-gradient(to bottom, #82dc7b, #61a45c);

另外,请查看http://colorzilla.com/gradient-editor/