Solution 1 :

Here’s another way to do it, putting the logic inside the class tag. This might be easier if you only have a few options.

<table>
  <tr>
    <th>Jam Recipe</th>
    {% for item in jam %}
     <td class="{% if item < 10 and item > 0 %}green{% else %}orange{% endif %}">
      {{ item }}
     </td>
    {% endfor %}
  </tr>
</table>

Problem :

<table>
  <tr><th>Jam Recipe</th>{% for item in jam %}{% if 0< item < 10 %}<td class="green">{{ item }}</td>
{% endif %}{% endfor %}</tr></table>

css:

   .green {color: green;}

I want to color the table in template.html in green color if values in list jame less than 10 but also more than 0.

It does color everythin in green that is less 10 includinig negative numbers. Alos the one more than 10 dissapeared and not shown however i want them to stay balck as all numbers’ initial color.

What is wrong and how to fix it ?

Any help is appreciated.