【问题标题】:How to set my Django form on the center of the page如何在页面中心设置我的 Django 表单
【发布时间】:2014-10-31 09:39:47
【问题描述】:

我的模板中有这段代码:

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

我的 css 文件中有这个:

 table {
  margin: 0 auto;
  }

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

【问题讨论】:

    标签: html css django django-forms


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2014-10-07
      • 2022-01-09
      • 1970-01-01
      • 1970-01-01
      • 2011-03-13
      • 1970-01-01
      • 2021-11-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多