gpt4 book ai didi

html - 如何在页面中心设置我的 Django 表单

转载 作者:行者123 更新时间:2023-11-28 09:31:11 25 4
gpt4 key购买 nike

我的模板中有这段代码:

 <form method="post" action=""> {% csrf_token %}
<table>
{{ form }}
</table>
<input type="submit" class="b1" value="OK" >
</form>

我的 css 文件中有这个:

 table {
margin: 0 auto;
}

在这种情况下,只有页面中心的表单字段。但是标签输入在页面的右侧。如何连接表单域和输入,使它们位于页面的中心

最佳答案

尝试将您的输入放在表格行中。

<form method="post" action=""> {% csrf_token %}
<table>
{{ form }}
<tr colspan=2>
<input type="submit" class="b1" value="OK" >
</tr>
</table>
</form>

关于html - 如何在页面中心设置我的 Django 表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25702741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com