Can I use transparent color with gradients in IE?
I've tried
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=transparent, endColorstr=red);
Oddly, this creates a gradient from blue to black, even in IE9.
Can I use transparent color with gradients in IE?
I've tried
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=transparent, endColorstr=red);
Oddly, this creates a gradient from blue to black, even in IE9.
There's no mention for "transparent" value being supported by (start|end)ColorStr
attribute. For Internet Explorer 8 and below you can try the following code:
.transparentGradient {
/* The element needs layout */
zoom: 1;
filter: progid:DXImageTransform.Microsoft.gradient(
gradientType=1, startColor=0, endColorStr=#FFFFFF
);
-ms-filter: progid:DXImageTransform.Microsoft.gradient(
gradientType=1, startColor=0, endColorStr=#FFFFFF
);
}
Here's a working example. I have tested it in IE8, its compatibility mode, and in IE6.
The startColor
and endColor
parameters accept:
Integer that specifies or receives the color value that can range from 0 (transparent) to 4294967295 (opaque white).
See: http://msdn.microsoft.com/en-us/library/ms532929(v=vs.85).aspx
You can also use a startColorStr
or/and endColorStr
which accept:
String that specifies or receives a value that can range from #FF000000 to #FFFFFFFF.
So you can specify the colors in "#RRGGBB" (as in the example) or "#AARRGGBB" formats, the latter being defined as:
Color is expressed in #AARRGGBB format, where AA is the alpha hexadecimal value, RR is the red hexadecimal value, GG is the green hexadecimal value, and BB is the blue hexadecimal value. The alpha value controls the opacity of the object. An alpha value of 00 is transparent, while a value of FF is opaque.
The default value is #FF0000FF
(opaque blue) and if you pass a value that is out of range then it defaults to it. See: http://msdn.microsoft.com/en-us/library/ms532930(v=vs.85).aspx
Don't forget that:
An object must have layout for the filter to render.
See: http://msdn.microsoft.com/en-us/library/ie/ms530752(v=vs.85).aspx
This works:
#000000FF
so:
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#000000FF, endColorstr=red);
And, not tested, but I hear that 0 works as well. Then it's startColor, not startColorstr.