.linear1 { display : block; width : 400; height : 200; background-image : linearGradient(left,[ [alpha(yellow,0.4), 0.4], [red, 1] ]); } function bottomRightAngle(w,h) { return -Math.floor(Math.tan(h/w)*180/Math.PI)+'deg'; } var w = 400; var h = 200; .linear2 { display : block; width : w; height : h; // warning angled gradient is not supported by IOS background-image : linearGradient(bottomRightAngle(w,h), [ [aqua, 0], [blue, 0.5], [rgba(0, 0, 255, 0), 1], ]); } function rainbowGradient(color) { var num = 6; var stops = [], shift; for (var i=0;i<=num;i++) { shift = i/num; stops.push([ blueshift(color,shift), shift ]); } return stops; } .linear3 { display : block; width : 400; height : 200; background-image : linearGradient(topLeft,rainbowGradient(rgb(255,255,0))); }