Adding different style to each condition in flask [duplicate]

Solution 1:

Instead of changing the css, you can change the color in html. You can use jinja2 templates to pass the color value from python to html.

Html

style='color: {{msg4color}}'

Then in python set the color value to red or green depending on the else statement. Then pass it on to the render template