JSFiddle - React, Tailwind, and code Playground
by Annie Lagang
HTML
<div class='my-legend'>
<div class='legend-scale'>
<ul class='legend-labels'>
<li><span style='background:#BEBADA;'></span></li>
<li>Three</li>
<li><span style='background:#FB8072;'></span></li>
<li>Four</li>
<li><span style='background:#80B1D3;'></span></li>
<li>Five</li>
</ul>
</div>
</div>
CSS
.my-legend .legend-title {
text-align: left;
margin-bottom: 5px;
font-weight: bold;
font-size: 90%;
}
.my-legend .legend-scale ul {
margin: 0;
margin-bottom: 5px;
padding: 0;
float: left;
list-style: none;
}
.my-legend .legend-scale ul li {
display: inline-block;
font-size: 80%;
list-style: none;
line-height: 18px;
vertical-align: text-top;
}
.my-legend ul.legend-labels li span {
display: inline-block;
height: 16px;
width: 20px;
margin-right: 5px;
margin-left: 10px;
border: 1px solid #999;
}
.my-legend a {
color: #777;
}