Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
275 views
in Technique[技术] by (71.8m points)

html - Why Displaying different gradient color on IE but works perfectly on firefox and chrome?

I am working on one of the opensource projects. I am facing a weird problem. When I open the website on Firefox or Chrome it displays the color I expect, but on IE it does not show up in that color (it shows very light color). My guess is, that this is happening because of the gradient I am using which IE is not able to interpret correctly. Here is gradient CSS code:

#mainmenu {
  #css3_backgroundLinearGradient({
    'angle': 'top',
    'colors': [
      {'color': '#77D3F8', 'position': '0%'},
      {'color': '#3FA4D8', 'position': '100%'}
    ]
  })
  box-shadow: 0px 1px 2px $theme.linkColor;
}

When I do the view source on web page, I also see a line i.e:

  <div class="gradientfilterIE"></div>.   

I am not sure, is this line the culprit? But the complete open source project source code does not have this line with gradientfilterIE. I am not sure if this line is causing the issue then where is it coming from?

I need your expert opinion why I see different gradient color on IE but works perfectly on Firefox and Chrome.

Setting this actually solved my problem:

#mainmenu .gradientfilterIE {
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#77D3F8',     endColorstr='#3FA4D8',GradientType=0 );
}

Do we require filter: progid:DXImageTransform.Microsoft.gradient only for IE? Because on Firefox and Chrome, without this it also works fine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Gradients only work in modern browsers and not IE but that CSS you show is invalid in the first place.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...