Wtforms表单域文本放大
Wtforms form field text enlargement
我刚开始使用 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>
在此先感谢您,如果这个问题已经在其他地方得到回答,我们深表歉意。
您可以使用 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中定义字体大小:
#larger {
font-size: 60px;
}
#middle {
font-size: 40px;
}
我刚开始使用 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>
在此先感谢您,如果这个问题已经在其他地方得到回答,我们深表歉意。
您可以使用 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中定义字体大小:
#larger {
font-size: 60px;
}
#middle {
font-size: 40px;
}