I've implemented a multicolored bar as shown in the image below. It is a bar that is placed above the legend of an HTML form. (Ignore the border radius for now.)
I have accomplished this with a simple approach of using span
elements.
*{
margin: 0px;
padding: 0px;
}
span{
height: 5px;
width: calc(100% / 7);
background: black;
display: inline-block;
}
span[data-color='green']{
background: #C3E279;
}
span[data-color='pale-yellow']{
background: #F7FEC8;
}
span[data-color='orange']{
background: #FFD069;
}
span[data-color='red']{
background: #F27669;
}
span[data-color='light-purple']{
background: #DC9CBE;
}
span[data-color='purple']{
background: #C59AE0;
}
span[data-color='blue']{
background: #969DCC;
}
<div id="decoration">
<span data-color="green"></span><span data-color="pale-yellow"></span><span data-color="orange"></span><span data-color="red"></span><span data-color="light-purple"></span><span data-color="purple"></span><span data-color="blue"></span>
</div>
Is there a better way to do this to make the code smarter, presentable and easy to understand to other developers?
orange
,red
, etc.? \$\endgroup\$