Edit in JSFiddle

<div class="gradient"></div>
<div class="gradient" style="width: 200px;"></div>
.gradient {
background-image: 
linear-gradient( to right,  #ff0000 0px,  #000000 200px, #0000ff 400px);
height:50px;
margin-bottom:5px;
}