无法应用线性渐变

时间:2014-11-03 11:22:08

标签: html css

UI团队为按钮背景提供了以下线性渐变

linear-gradient(bottom, #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%), linear-gradient(bottom, #E4E8EA 0%, #e8ebed 50%, #F1F3F4 96.36%, #FFFFFF 100%)

我尝试了如下

background-image: -webkit-linear-gradient(bottom, #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%), -webkit-linear-gradient(bottom, #E4E8EA 0%, #e8ebed 50%, #F1F3F4 96.36%, #FFFFFF 100%);
background-image: -moz-linear-gradient(bottom, #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%), -moz-linear-gradient(bottom , #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%);
background-image: -o-linear-gradient(bottom, #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%), -o-linear-gradient(bottom, #E4E8EA 0%, #e8ebed 50%, #F1F3F4 96.36%, #FFFFFF 100%);
background-image: -ms-linear-gradient(bottom, #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%), -ms-linear-gradient(bottom, #E4E8EA 0%, #e8ebed 50%, #F1F3F4 96.36%, #FFFFFF 100%);
background-image: linear-gradient(bottom, #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%), linear-gradient(bottom, #E4E8EA 0%, #e8ebed 50%, #F1F3F4 96.36%, #FFFFFF 100%);

但我无法应用此功能。他们给出了两个颜色相同的渐变色。我也试过只有一个渐变,但没有运气。任何人都可以让我知道上面的CSS有什么问题吗?

2 个答案:

答案 0 :(得分:0)

我正在使用ColorZilla。过去就像这样 -

.your-class {
background: linear-gradient(bottom, #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%), linear-gradient(bottom, #E4E8EA 0%, #e8ebed 50%, #F1F3F4 96.36%, #FFFFFF 100%);
}

您的代码看起来有点短,如果您从ColorZilla复制它,那么它应该看起来像这样 -

background: #f1f3f4; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2YxZjNmNCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUxJSIgc3RvcC1jb2xvcj0iI2U4ZWJlZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlNGU4ZWEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top,  #f1f3f4 0%, #e8ebed 51%, #e4e8ea 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f1f3f4), color-stop(51%,#e8ebed), color-stop(100%,#e4e8ea)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #f1f3f4 0%,#e8ebed 51%,#e4e8ea 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #f1f3f4 0%,#e8ebed 51%,#e4e8ea 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #f1f3f4 0%,#e8ebed 51%,#e4e8ea 100%); /* IE10+ */
background: linear-gradient(to bottom,  #f1f3f4 0%,#e8ebed 51%,#e4e8ea 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f1f3f4', endColorstr='#e4e8ea',GradientType=0 ); /* IE6-8 */

答案 1 :(得分:0)

对于没有浏览器前缀的代码,它是“到底”。

其他人只需查看此网站: http://www.colorzilla.com/gradient-editor/