To achieve a cross-browser linear gradient, it's essential to account for differences between browsers. Here are the alternatives for Opera and Internet Explorer (IE):
background-image: -o-linear-gradient(right, #0c93C0, #FFF);
/*IE7-*/ filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#0c93c0', endColorStr='#FFFFFF', GradientType=0); /*IE8+*/ -ms-filter: "progid:DXImageTransform.Microsoft.Gradient(startColorStr='#0c93c0', endColorStr='#FFFFFF', GradientType=0)";
background-image: -ms-linear-gradient(right, #0c93C0, #FFF);
To create a horizontal gradient, use the left or right direction instead of top or bottom.
Note that experimental CSS properties use prefixes to indicate the browser they are intended for:
For IE, the -ms-filter syntax is as follows:
-ms-filter: progid:DXImageTransform.Microsoft.Gradient( startColorStr='#0c93c0', /*Start color*/ endColorStr='#FFFFFF', /*End color*/ GradientType=0 /*0=Vertical, 1=Horizontal gradient*/ );
GradientType is optional and can be omitted.
The above is the detailed content of How Can I Create a Cross-Browser Linear Gradient?. For more information, please follow other related articles on the PHP Chinese website!