Can you use rgba colours in gradients produced with Internet Explorer’s filter property?

淺唱寂寞╮ 提交于 2019-11-28 05:13:36

问题


Internet Explorer’s filter CSS property (-ms-filter from IE 8) allows you to do CSS gradients, a bit like the -webkit-gradient and -moz-gradient properties (see e.g. question 213750).

However, the syntax doesn’t seem to allow for rgba colours, so you can’t do a gradient from a colour to transparent.

Is there any way to achieve gradients that end in transparency in IE?


回答1:


Stop colors can be specified in #AARRGGBB notation, where AA represents the alpha. For example, #ffff0000 is fully-opaque red.

This produces a 100% red to 50% black horizontal gradient:

filter: progid:DXImageTransform.Microsoft.Gradient(
    GradientType=1, 
    StartColorStr='#ffff0000', 
    EndColorStr='#80000000'
);

jsFiddle preview



来源:https://stackoverflow.com/questions/5159136/can-you-use-rgba-colours-in-gradients-produced-with-internet-explorer-s-filter-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!