首页 > 解决方案 > 我正在使用 django 清脆的表单我如何更改此文本以从顶部开始并在行满时到达下一行

问题描述

所以伙计们,我的网站现在看起来像这样。

这里是网站!如果你没有从标题中,你肯定会明白我的问题, 截屏

HTML

{% load crispy_forms_tags %}

<div class="row">
    <div class="col-md-6 offset-md-3" id="ada">
        <h3>Makale Ekle</h3>
        <hr>
        <form method = "post">
            {% csrf_token %}
            
            {{form|crispy}}
            <br>
            <button type = "submit" class = "btn btn-danger">Ekle</button>
        </form>
    </div>
</div>

CSS

body {
    background: rebeccapurple;
    font-family: Arial, Helvetica, sans-serif;
}


#ada {
    margin: auto;
    margin-top: 100px;
    padding-top: 5rem;
    padding-bottom: 5rem;
    border: 5px solid rgb(49, 2, 68);
    background-color: purple;
    border-radius: 5%;
}

h3 {
    font-size: 2rem;
    color: white;
}

label {
    color: white;
}

input {
    width: 800px;
    margin-bottom: 1.2rem;
    size: 2rem;
    border: 3px solid purple;
    text-align: justify;
}

input[name="context"] {
    height: 10rem;
    padding: 20px 10px;
    line-height: 28px;
}

所以伙计们,我认为我错过了一些简单的事情。我试图通过在 CSS 中添加一些代码来解决它,但它肯定不起作用。

标签: htmlcssdjango

解决方案


您应该在 forms.py 使用 TextArea 小部件

我可以举个例子。

表格.py

def class FeedbackForm(forms.Form):
     title = forms.CharField(label="Title",widget=forms.TextInput)
     message = forms.CharField(label="Message", widget=forms.Textarea)

反馈表


推荐阅读