Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradient colors in Internet Explorer

I know that Internet Explorer has some proprietary extensions so that you can do things like create divs with a gradient background. I can't remember the element name or it's usage. Does anyone have some examples or links?

like image 598
Jeremy Avatar asked Oct 17 '08 20:10

Jeremy


People also ask

What browsers support linear gradient?

Cross Browser Compatibility Solution For CSS 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.

How do you give a gradient a color?

Select the Gradient tool in the toolbar. In the selected artwork you'll see the gradient annotator, which shows the gradient slider and the color stops. Double-click a color stop on the artwork to edit the color, drag the color stops, click beneath the gradient slider to add new color stops, and more.

What is gradient color called?

Gradients, also known as color transitions, are a gradual blending from one color to another color (or, if you're in a colorful mood, from one color to another color to another color—gradients aren't limited to two shades).


2 Answers

The code I use for all browser gradients:

background: #0A284B; background: -webkit-gradient(linear, left top, left bottom, from(#0A284B), to(#135887)); background: -webkit-linear-gradient(#0A284B, #135887); background: -moz-linear-gradient(top, #0A284B, #135887); background: -ms-linear-gradient(#0A284B, #135887); background: -o-linear-gradient(#0A284B, #135887); background: linear-gradient(#0A284B, #135887); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0A284B', endColorstr='#135887'); zoom: 1; 

You will need to specify a height or zoom: 1 to apply hasLayout to the element for this to work in IE.


Update:

Here is a LESS Mixin (CSS) version for all you LESS users out there:

.gradient(@start, @end) {     background: mix(@start, @end, 50%);     filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorStr="@start~", EndColorStr="@end~")";     background: -webkit-gradient(linear, left top, left bottom, from(@start), to(@end));     background: -webkit-linear-gradient(@start, @end);     background: -moz-linear-gradient(top, @start, @end);     background: -ms-linear-gradient(@start, @end);     background: -o-linear-gradient(@start, @end);     background: linear-gradient(@start, @end);     zoom: 1; } 
like image 108
Blowsie Avatar answered Sep 30 '22 00:09

Blowsie


Look at the custom CSS filters IE can handle http://msdn.microsoft.com/en-us/library/ms532847.aspx

like image 44
Nick Avatar answered Sep 29 '22 23:09

Nick