Paul D. Waite
Paul D. Waite

Reputation: 98866

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

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?

Upvotes: 3

Views: 735

Answers (1)

BoltClock
BoltClock

Reputation: 724252

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

Upvotes: 5

Related Questions