【发布时间】:2022-01-02 13:58:56
【问题描述】:
我尝试将我的<textarea> 元素集中在我的宠物项目中,但我找不到这样做的方法。我尝试过使用以下方法:
- 在 CSS 中更改我的文本区域:
textarea {
display: flex;
justify-content: center;
align-items: center;
}
- 使用 text-align 属性:
<div style="text-align: center"><textarea>I am <textarea></textarea></div>
- 也使用
<center>标签。令人惊讶的是,它奏效了。但我不喜欢这种解决方案,因为它注定要使用。
下面是我项目中图片的链接(我不能发布一张,因为我没有足够的声誉)。在这里你可以看到我有两个块:Django框架提供的textarea和标准的HTML textarea。两者都不居中。 (https://i.imgur.com/1AzKrWJ.png)
这是我的代码:<p>Write the reason(s) for refusal:</p>
{% render_field form.refusal_reason placeholder="Text..." %}
<div style="text-align: center"><textarea>I am <textarea></textarea></div>
我一直在寻找解决方案,但没有成功。我很乐意提供任何有用的答案。
【问题讨论】: