-1

I am writing a Python application that runs a Flask webserver. The webserver returns template pages to the user. Take an example line from my html file: <div class="column" style= {{ column.color }}> with the corresponding color variable: "background: lightgreen" For some reason unbeknownst to me, Jinja2 renders that line of html as: <div class="column" style="background:" lightgreen=""> and not the expected: <div class="column" style="background:lightgreen">

The reason this matters is because what it renders is not correct css and so the background is not set to the lightgreen color like i intend. Why does this happen and what is the solution?

1 Answers1

0

You've missed quotes in the style attribute:

<div class="column" style="{{ column.color }}">
Kosh
  • 16,966
  • 2
  • 19
  • 34