Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradients in Internet Explorer 9

Does anyone know the vendor prefix for gradients within IE9 or are we still supposed to still be using their proprietry filters?

What I've got for the other browsers is:

background-image: -moz-linear-gradient(top, #444444, #999999); /* FF3.6 */ background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #444444),color-stop(1, #999999)); /* Saf4+, Chrome */ filter:  progid:DXImageTransform.Microsoft.gradient(startColorStr='#444444', EndColorStr='#999999'); /* IE6,IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#444444', EndColorStr='#999999')"; /* IE8 */ 

As a bonus does anyone know Opera's vendor prefix as well?

like image 423
Sniffer Avatar asked Oct 14 '10 15:10

Sniffer


People also ask

Does Internet Explorer support linear gradient?

All desktop browsers including Internet Explorer 11 and Microsoft Edge provide browser support for Linear CSS Gradients, meaning these CSS Gradients offer excellent cross browser compatibility.

What are the three types of gradients?

CSS defines three types of gradients: Linear Gradients (goes down/up/left/right/diagonally) Radial Gradients (defined by their center) Conic Gradients (rotated around a center point)

Can I use linear gradient in background color?

Because <gradient> s belong to the <image> data type, they can only be used where <image> s can be used. For this reason, linear-gradient() won't work on background-color and other properties that use the <color> data type.


2 Answers

Looks like I'm a little late to the party, but here's an example for some of the top browsers:

/* IE10 */  background-image: -ms-linear-gradient(top, #444444 0%, #999999 100%);  /* Mozilla Firefox */  background-image: -moz-linear-gradient(top, #444444 0%, #999999 100%);  /* Opera */  background-image: -o-linear-gradient(top, #444444 0%, #999999 100%);  /* Webkit (Safari/Chrome 10) */  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #444444), color-stop(1, #999999));  /* Webkit (Chrome 11+) */  background-image: -webkit-linear-gradient(top, #444444 0%, #999999 100%);  /* Proposed W3C Markup */  background-image: linear-gradient(top, #444444 0%, #999999 100%); 

Source: http://ie.microsoft.com/testdrive/Graphics/CSSGradientBackgroundMaker/Default.html

Note: all of these browsers also support rgb/rgba in place of hexadecimal notation.

like image 114
Kevin Arthur Avatar answered Oct 21 '22 16:10

Kevin Arthur


The best cross-browser solution is

background: #fff; background: -moz-linear-gradient(#fff, #000); background: -webkit-linear-gradient(#fff, #000); background: -o-linear-gradient(#fff, #000); background: -ms-linear-gradient(#fff, #000);/*For IE10*/ background: linear-gradient(#fff, #000); filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ffffff', endColorstr='#000000');/*For IE7-8-9*/  height: 1%;/*For IE7*/  
like image 36
goksel Avatar answered Oct 21 '22 14:10

goksel