Linear gradient works fine for all browsers except IE8.
I added progid:DXImageTransform.Microsoft.gradient
...this did give it some gradient however 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 do I make this gradient linear?
The linear-gradient() function sets a linear gradient as the background image. To create a linear gradient you must define at least two color stops. Color stops are the colors you want to render smooth transitions among. You can also set a starting point and a direction (or an angle) along with the gradient effect.
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.
Definition and Usage. The linear-gradient() function sets a linear gradient as the background image. To create a linear gradient you must define at least two color stops. Color stops are the colors you want to render smooth transitions among.
The css I use to create a linear gradient is as follows. Works fine in IE8 too. Seems the only difference to yours is I set a gradientType to 1 (horizontal), not 0 (vertical), and I use distinct colours.
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/
The other issue is that you are using close to white colours, so the gradient effect isnt that noticeable. Try changing to a more distinct starting colour such as #ff000 to see if the gradient is actually working first. Also you have a duplicate background-color value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With