gradient background css with percentage code example
Example 1: linear-gradient
background: linear-gradient(to left, #333, #333 50%, #eee 100%);
Example 2: css linear gradient
#gradient {
background-image: linear-gradient(180deg, black, red);
}
Example 3: html get color gradient percentage
function pickHex(color1, color2, weight) {
var w1 = weight;
var w2 = 1 - w1;
var rgb = [Math.round(color1[0] * w1 + color2[0] * w2),
Math.round(color1[1] * w1 + color2[1] * w2),
Math.round(color1[2] * w1 + color2[2] * w2)];
return rgb;
}