Wtforms表单域文本放大

标签 wtforms flask-wtforms

我是 wtforms 和 flask 的新手,正在尝试扩大物理字段的大小和其中的字体。我应该使用一段特定的代码还是用 css 更改它。

<div class="container">
<div class="col-md-12">

    <form id="signinform" class="form form-horizontal" method="post" role="form" style="font-size:24px;">
    {{ form.hidden_tag() }}
    {{ wtf.form_errors(form, hiddens="only") }}
    {{ wtf.form_field(form.first_name, autofocus=true) }}
    {{ wtf.form_field(form.last_name) }}
    {{ wtf.form_field(form.company) }}
    {{ wtf.form_field(form.reason) }}
    {{ wtf.form_field(form.us_citizen) }}
    {{ form.signature }}
    </form>

This is what it currently looks like. I want the field to be bigger and the font when typed out to be bigger too.

在此先感谢您,如果这个问题已经在其他地方得到回答,我们深表歉意。

最佳答案

您可以使用 TextAreaField 并定义大小。

from wtforms import TextAreaField
from wtforms.widgets import TextArea
class NameForm(Form):
    first_name = TextAreaField('First Name', widget=TextArea())

在要放大的字段中添加一个id:

{{ form.first_name.label(id='middle')  }}
{{ form.first_name(cols="20", rows="1", id='larger') }}

然后在 CSS 中定义 font-size:

#larger {
font-size: 60px;
}

#middle {
font-size: 40px;
}

关于Wtforms表单域文本放大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38749364/

相关文章:

python - Flask 和 WTForms - 如何确定文件上传字段是否已提交用于处理目的

python - WTForms 2.3.0 重大更改 - ImportError : cannot import name 'HTMLString' from 'wtforms.widgets'

python - Jinja 字典值未显示

python - 如何在 flask 中建立一个获取表单的帖子

python - wtforms 验证下拉值

python-3.x - 根据 flask 中的其他选择选项显示选择字段

python - 我可以在 __init__ wtforms 中添加字段吗

python - 如何将 Bootstrap 工具提示与 Python WTForms 库一起使用?

python - WT 表单:错误 "field not present"

python - self.__class__ 的错误类继承?