Simulating color stops in gradients for IE

2019-02-16 16:49发布

I want to give a div a gradient with multiple color-stops, which IE's filter property does not support. Anyone have a creative workaround to simulate the color stops in IE? I already thought of creating multiple divs right next to each other... anything else?

Thanks!

3条回答
萌系小妹纸
2楼-- · 2019-02-16 17:10

Or use CSS3 PIE. Way easy.

From Setting linear gradient's starting and ending position in MSIE 9 and older

div {
    background-image: -moz-linear-gradient(360deg,rgb(255,255,255) 25% ,rgb(241,123,25) 75%);

    -pie-background: linear-gradient(360deg,rgb(255,255,255) 25% ,rgb(241,123,25) 75%);
behavior: url(/PIE.htc);
}

Update: if the div has a top margin then it seems to do away with it. At least in my case. Don't know if it's a combination of two things.

查看更多
该账号已被封号
3楼-- · 2019-02-16 17:17

I'd recommend you to use a background image as a fallback for browsers (as Opera and IE) that don't support CSS gradients.

查看更多
够拽才男人
4楼-- · 2019-02-16 17:31

Multiple divs with coordinated gradient colors is the best way (short of using images) to create 3+ color gradients. See fiddle below for a working test:

http://jsfiddle.net/Hauhx/

查看更多
登录 后发表回答