Is it possible to make the below gradient look more "blocky", so that instead of switching from green to red gradually, it's done in steps like the below picture?
Desired effect:
Currently:
#gradients {
background-image: -webkit-gradient(linear, left bottom, right bottom, color-stop(0, #00FF00), color-stop(0.5, #FFFF00), color-stop(1, #FF0000));
background-image: -o-linear-gradient(right, #00FF00 0%, #FFFF00 50%, #FF0000 100%);
background-image: -moz-linear-gradient(right, #00FF00 0%, #FFFF00 50%, #FF0000 100%);
background-image: -webkit-linear-gradient(right, #00FF00 0%, #FFFF00 50%, #FF0000 100%);
background-image: -ms-linear-gradient(right, #00FF00 0%, #FFFF00 50%, #FF0000 100%);
background-image: linear-gradient(to right, #00FF00 0%, #FFFF00 50%, #FF0000 100%);
}
<div id="gradients" style="width:450px; height:20px"></div>
Ideally, I'd be able to set a variable so I can choose how many blocks the gradient would consist of. Can anyone help?