JSFiddle - React, Tailwind, and code Playground

HTML

<table border="1">
    <tr>
        <td>1</td>
        <td>4</td>
        <td>12</td>
    </tr>
</table>

CSS

table td {
    padding: 5px 30px;
}

JavaScript

var cell = $('td');

cell.each(function() {
    var cell_value = $(this).html();
    if ((cell_value >= 0) && (cell_value <=2)) {
        $(this).css({'background' : '#FF0000'});   
    } else if ((cell_value >= 3) && (cell_value <=7)) {
        $(this).css({'background' : '#0066CC'});
    } else if (cell_value >= 8) {
        $(this).css({'background' : '#00CC66'});
    }
});