Reputation: 399
I have this line in a foor loop in flask and I want to set variable that would be increase each loop by a certain number. So f.e. margin-top is 50, 100, 150
<td style="margin-top:50px;">
Can anyone hint me a how to do such a loop, please? Is it possible to do it within this framework? Thanks
{% for picture in pictures[item.id]%}
<td style="margin-top:50px;">
<img src="{{url_for('static', filename=picture)}}" style="z-index:0;" />
</td>
<!--<div class="image_description">{{ picture.split('/')[-1].split('.')[0] }}</div>-->
{% endfor %}
Upvotes: 0
Views: 165
Reputation: 26
What would you go for all this trouble? Just create a class in css
and add it to each <td>
.
.myclass-with-50-margin-top {
margin-top: 50px;
}
The result remains the same.
Edit:
{{rowCount = 0}}
{% for picture in pictures[item.id]%}
<td style="margin-top: {{count += 25}}px">
<img src="{{url_for('static', filename=picture)}}" style="z-index:0;" />
</td>
{% endfor %}
Upvotes: 1