jack rackham jack rackham - 1 year ago 80
HTML Question

Python: How to override text area in form using CSS

Hi I would like to ask on how to override the text area in form using CSS.
This is my codes:


description = forms.CharField(widget=forms.Textarea(attrs={'class': 'comment-control'}))


.comment-control {
background-color: #fff;
width: 830px;
height: 110px;


<form name="add_comment" id="comment-form" action="{% url 'comment:create' refId=refApp.id refApp=thisApp %}" method="post">
{% csrf_token %}
{{ form }}

I want to change the layout of the textarea of form using CSS but it is not being inherited, I appreciate your help. Thank you

Answer Source

you should do something like this:

description = forms.CharField(widget=forms.Textarea(attrs={'cols':'4', 'rows':'50'}))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download