请参阅下面的CSS跨浏览器代码:
.bar {
height: 10px;
width: 350px;
background: -webkit-linear-gradient(left,red 0%,red 14.28%,orange 14.28%,orange 28.57%,yellow 28.57%,yellow 42.85%,green 42.85%,green 57.14%,blue 57.14%,blue 71.43%,indigo 71.43%,indigo 85.72%,violet 85.72%,violet 100%);
background: red; /* For browsers that do not support gradients */
/* For Opera 11.1 to 12.0 */
background: -o-linear-gradient(left,violet 100%);
/* For Fx 3.6 to 15 */
background: -moz-linear-gradient(left,violet 100%);
/* Standard Syntax */
background: linear-gradient(to right,violet 100%);
}