How to apply linear gradient for IE8

Linear gradient works great for all browsers except IE8.
I added progid:DXImageTransform.Microsoft.gradient ... this gave it some gradient, however the expected result is different.
Code: -

 div{ height:500px;width:500px; background-size: 50px 50px; background-color: #DDEEEE; background-image: -webkit-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent); background-image: -moz-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent); background-image: -ms-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent); background-image: -o-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent); background-image: linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#DDEEEE',GradientType=0 );} 

How to make this gradient linear?

+6
source share
1 answer

The css that I use to create a linear gradient is as follows. It works great in IE8. It seems the only difference is for you: I set gradientType to 1 (horizontal), not 0 (vertical), and I use different colors.

HTML

 <div></div> 

CSS

 div{width:400px;height:200px; /*gradient background color */ background: #0071a0; /* Old browsers */ background: -moz-linear-gradient(left, #0071a0 1%, #ff0000 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, right top, color-stop(1%,#0071a0), color-stop(100%,#ff0000)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(left, #0071a0 1%,#00a3ca 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(left, #0071a0 1%,#ff0000 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(left, #0071a0 1%,#ff0000 100%); /* IE10+ */ background: linear-gradient(to right, #0071a0 1%,#ff0000 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0071a0', endColorstr='#ff0000',GradientType=1 ); /* IE6-9 */ } 

http://jsfiddle.net/yAxbJ/

Another problem is that you are using close to white colors, so the gradient effect is not noticeable. Try switching to a sharper starting color, such as # ff000, to see if the gradient really works. Also you have a repeating background background value.

+5
source

Source: https://habr.com/ru/post/947263/


All Articles