2016-12-21 87 views
0

我正在寻找文本上的彩虹效果。我有以下代码可以在除Internet Explorer之外的所有浏览器中使用。任何人都知道如何让这个在IE中工作?CSS渐变 - 未在Internet Explorer中显示

这里是一个jsFiddle

HTML:

<span class="icon-child-work"> 
    Hello 
</span> 

CSS:

.icon-child-work { 
    color: transparent; 
    background-image: -webkit-gradient(linear, left top, right top, color-stop(0.5,  #f22), color-stop(0.10, #f2f), color-stop(0.20, #22f), color-stop(0.25, #2ff), color-stop(0.30, #128C16),color-stop(0.40, #2f2), color-stop(0.45, #ff2), color-stop(0.55, #f2f)); 
    background-image: gradient(linear, left top, right top, color-stop(0.5, #f22), color-stop(0.10, #f2f), color-stop(0.20, #22f), color-stop(0.25, #2ff), color-stop(0.30, #128C16),color-stop(0.40, #2f2), color-stop(0.45, #ff2), color-stop(0.55, #f2f)); 
    -webkit-background-clip: text; 
    background-clip: text; 
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB)"; 

    padding-right: 10px; 
} 

回答

0

这将有助于解决背景渐变色旧版本的IE,但不是文本

background: linear-gradient(to bottom, #feffff 0%,#1471da 50%,#1C85FB 100%); /* Supports IE10+ and several other older browsers */ 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1471da', endColorstr='#1C85FB',GradientType=0); /* Supports IE6-9 */ 
+0

渐变显示为整个跨度的背景。我需要它通过文本筛选 –

+0

看起来像我“误读”了这个问题。什么是您需要支持的最旧版本?我会更新答案。 – Adrianopolis

+0

可悲的IE 9 ..... IE 8是可能的。 –