JSFiddle - React, Tailwind, and code Playground
by Annie Lagang
HTML
<div class='my-legend'>
<div class='legend-scale'>
<ul class='legend-labels'>
<li>
<span class="color" style='background:#BEBADA;'></span>
<span class="legend">Three</span>
<span class="color" style='background:#FB8072;'></span>
<span class="legend">Four</span>
<span class="color" style='background:#80B1D3;'></span>
<span class="legend">Five</span>
</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;
font-size: 80%;
list-style: none;
margin-left: 0;
line-height: 18px;
margin-bottom: 2px;
}
.my-legend ul.legend-labels li .color {
display: block;
float: left;
height: 16px;
width: 20px;
margin-right: 5px;
margin-left: 0;
border: 1px solid #999;
}
.my-legend ul.legend-labels li .legend {
display: block;
float: left;
height: 16px;
width: 40px;
margin-right: 5px;
margin-left: 0;
}
.my-legend a {
color: #777;
}