0
Friends, I have a list of items whose each item has a div
which expresses remaining days with an automatic date countdown function. Example:
<ul class="items">
<li class="item a"><div class="contagem-a">3 dias restantes</div></li>
<li class="item b"><div class="contagem-b">8 dias restantes</div></li>
<li class="item c"><div class="contagem-c">2 dias restantes</div></li>
<li class="item d"><div class="contagem-d">6 dias restantes</div></li>
<li class="item e"><div class="contagem-e">4 dias restantes</div></li>
</ul>
I want the background of the Divs to have a color according to the amount of days left over. Example: 1-2 days > red background. 3-4 days > yellow background. 5-6 day > green background. Because it is a large amount of items and the time changes automatically, I need it to be automated.
To do this, I imagine we need a function that identifies the alphanumeric order and can give access to the selected numbers from there...
Does anyone have any idea??
Instead of Jquery, you didn’t consider solving this with CSS only?
– Leandro Angelo
@Leandroangelo I don’t know how to do with CSS. how would it be?
– Thiago Soubra