I built a calendar, each day is a list item. It contains a span element with a data-count attribute. This attribute is intended to show the availabilty of a resource and is dynamically updated. I want to show this availability with the background color of the span. I can manage each value individually but I would like to manage it by ranges, for example if data-count is in [0, 999] the backgound is green, in [1000, 9999] with orange, and >= 10000 : red
Is there a way to manage this in css only (without any additionnal javascript or html change) ? (if yes how ? ) Is there a CSS selector to get all the spans with data-count in range [0, 999] ?
Here is the style
li { 
    list-style-type: none;
    display: inline-block;
    width: 18%;
    text-align: left;
    margin-bottom: 5px;
    background: #bbb;
    padding: 5px;
}
li span {
    display: inline-block;
    padding: 5px;
    width: 90%;
}
li span[data-count="50"] {
    background: lime;
}
li span[data-count="5001"] {
    background: orange;
}
li span[data-count="50000"] {
    background: red;
}
Here is the html
<ul>
    <li><span data-count="50" >1/1/70 - free</span></li><br>
    <li><span data-count="51" >2/1/70 - free</span></li><br>
    <li><span data-count="5001">3/1/70 - hurry up</span></li><br>
    <li><span data-count="50000">4/1/70 - last chance</span></li>
</ul>