【发布时间】:2010-11-16 05:16:58
【问题描述】:
我的表单中有很多字段我试图将不同的 css 应用于相邻表单字段,例如
<li class='thiscolor' >
<field>
</li>
<li class='thatcolor' >
<field>
</li>
如果有类似的方法
{% for field in form %}
**{% if forloop.counter%2 == 0 %}**
<li class='thiscolor'>
{% else%}
<li class='thatcolor'>
{%endif}
{{field}}
</li>
{% endfor %}
forloop.counter ?
非常感谢!
【问题讨论】:
标签: css django forms templates