I'm trying to make a webpage where JS will generate 2 colors and use them in a gradient. Here is what I have:
HTML
<div id="hi"></div>
CSS
div {
width:100px;
height:100px;
}
JS
var hue = Math.floor(Math.random() * 360);
var top = "hsl(" + hue + ",100%,30%";
var bottom = "hsl(" + hue + ",100%,50%)";
document.getElementById('hi').style.background = "linear-gradient(" + top + "," + bottom + ")";
Demo that doesn't work: http://jsfiddle.net/8pzaeo3w/16/