这曾经很好用,但是最近渐变在Webkit中无法正常工作。似乎在Firefox中没问题。有人可以检查我是否设置错误。不要注意图像。它是我无法渲染的渐变。有什么想法吗?
JSFIDDLE:http://jsfiddle.net/UdxUg/2/
-webkit-gradient
答案 0 :(得分:6)
这是由于旧的语法,通常webkit / blink现在允许使用无供应商的价值。
通常你应该使用:pseudo-element - > http://jsfiddle.net/UdxUg/6/
无论如何,这是一个有效的代码。
.create {
border: 1px solid #63ac5c;
background: #d9ead8 url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px;
background: url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px, -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dbe8d9), color-stop(100%, #bcd7b9));
/* Safari 4+, Chrome 2+ */
background: url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px, -moz-linear-gradient(top, #dbe8d9, #bcd7b9);
background: url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px, -webkit-linear-gradient(top, #dbe8d9, #bcd7b9);
background: url('http://tinyurl.com/mezxsk6') no-repeat 0px -10px, linear-gradient(top, #dbe8d9, #bcd7b9);
height: 23px;
text-align:center;
}
.create {
border: 1px solid #63ac5c;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dbe8d9), color-stop(100%, #bcd7b9)); /* Safari 4+, Chrome 2+ */
background: -webkit-linear-gradient(top, #dbe8d9, #bcd7b9);
background: -moz-linear-gradient(top, #dbe8d9, #bcd7b9);
background: linear-gradient(top, #dbe8d9, #bcd7b9);
height: 23px;
text-align:center;
position: relative
}
.create:before {
content: '';
background: #d9ead8 url('http://tinyurl.com/mezxsk6') no-repeat 0 0;
height: 23px;
width: 23px;
position: absolute;
top: 0;
left: 0;
}
答案 1 :(得分:0)
检查这个我总是使用这个生成器来生成渐变,它更快,而且很好。
CSS3 Ultimate Gradient Generator
顺便说一句,如果删除那些图像,渐变在webkit中就可以正常工作。
.create {
border: 1px solid #63ac5c;
background: rgb(188,215,185); /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIyNCUiIHN0b3AtY29sb3I9IiNiY2Q3YjkiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSI5OSUiIHN0b3AtY29sb3I9IiNkYmU4ZDkiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, rgba(188,215,185,1) 24%, rgba(219,232,217,1) 99%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(24%,rgba(188,215,185,1)), color-stop(99%,rgba(219,232,217,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(188,215,185,1) 24%,rgba(219,232,217,1) 99%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(188,215,185,1) 24%,rgba(219,232,217,1) 99%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(188,215,185,1) 24%,rgba(219,232,217,1) 99%); /* IE10+ */
background: linear-gradient(to bottom, rgba(188,215,185,1) 24%,rgba(219,232,217,1) 99%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bcd7b9', endColorstr='#dbe8d9',GradientType=0 ); /* IE6-8 */
height: 23px;
text-align:center;
}