【问题标题】:Trying to add input-lg to wtform尝试将 input-lg 添加到 wtform
【发布时间】:2016-08-30 02:32:17
【问题描述】:

我正在尝试在我的 wtform 字段上使我的输入字段更大。我发现这篇文章展示了如何使用表单控件,

{{ form.email(class_="form-control") }} Add a css class to a field in wtform

还有这个关于如何使用 input-lg 的引导程序,

input class="form-control input-lg" id="inputlg" type="text" http://www.w3schools.com/bootstrap/bootstrap_forms_sizing.asp

但它们在我的代码中并没有一起工作。没有错误它只是不起作用。

<form id="signinform" class="form form-horizontal" method="post"
          role="form" style="font-size:24px;”>
{{ form.hidden_tag() }}
{{ wtf.form_field(form.last_name, class_="form-control input-lg") }}
</form>

还有一些表单行,但不需要包含它们。

我怎样才能做到这一点?我究竟做错了什么? (我有引导程序,所有东西都已经导入)

谢谢

【问题讨论】:

  • 如果您只有一个字段,那么您可以轻松增加字段宽度,否则如果您有更多字段,请使用 div 并在 div 内部使用 class "col-md-5" 和 "col-md -5 col-md-offset-2"。参见 bootstarp modal 教程
  • 我实际上只使用了一些 javascript,只是它更大,如果你遇到同样的问题,这里是我使用的代码:$(document).ready(function (){ $ ("#XX 输入").addClass('input-lg'); }); XX=表单的id

标签: twitter-bootstrap wtforms flask-wtforms


【解决方案1】:

您可以更改字段的 CSS。为字段命名,然后在 CSS 中添加相应的样式。

【讨论】:

    猜你喜欢
    • 2021-10-12
    • 2014-08-29
    • 2014-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多