Post my solution, hoping this helps someone else. I knew that you would create fields using css, but donβt know how to assign classes to each element. But if you look at the default template, you will notice that an error class is assigned to the field using the if statement in the foreach loop, which automatically generates every field in your form. i.e.
{% for field in form %} < p{% if field.errors %} class="error" {% endif %} {{ field.label_tag }}<'/' p> {% endfor %}
So, I added to this function.
< p{% if field.errors %} class="error" {% endif %} {% ifequal field.name "honeypot" %} id="hide" {% else %} id="left" {% endifequal %}> {{ field.label_tag }}<'/' p>
my css
#hide{ display:none; } #left{ width: 200px; text-align: left; } #right{ width: 300px; text-align: left; }
Now that you can set your classes, you can easily customize your classes or identifier in your css file. This is for comments. If you use {{form.as_p}} or {{form.as_table}} to generate your form, then you simply set a common form class in your CSS to style it. i.e.
form { width: 350px; padding: 20px; border: 1px solid #270644; }
darren
source share