如何减小django中使用的html中输入框的大小

How to reduce size of input box in html used in django

有什么方法可以缩小下面使用的描述框的大小吗?我在 django 项目下的 HTML 模板上使用它,当我渲染页面时描述框很大。

<div class="container-fluid">
                    <div class="card-body">
                        <form action="{% url 'create_post' pk=classroom.id %}" method="POST" enctype="multipart/form-data">
                            {% csrf_token %}
                            <div class="form-group">
                                {{ post_form.title|attr:"class:form-control"|attr:"placeholder:Title"}}
                            </div>
                            <div class="container">
                                {{ post_form.description|attr:"class:form-control"|attr:"placeholder:Description" }}
                            </div>
                            <button type = "submit" class="btn btn-sm btn-primary m-1 pl-3 pr-3 float-right">
                                Post
                            </button>
                            <button id = "cancel-post" class="btn btn-sm btn-outline-dark m-1 float-right">
                                Cancel
                            </button>
                        </form>
                    </div>
                </div>

试试这个

{{ post_form.description|attr:"class:form-control"|attr:"placeholder:Description"|attr:"rows:4"}}

https://pypi.org/project/django-widget-tweaks/

https://github.com/jazzband/django-widget-tweaks#attr

{% load widget_tweaks %}
    
<!-- add/change several attributes -->
{{ form.text|attr:"rows:20"|attr:"cols:20"|attr:"title:Hello, world!" }}