我没有意识到,但当rails看到
maxwidth: 50
,它会自动添加:
size: 50
.
我只是添加一个
size: 25
对于表单字段助手,这些字段的宽度变为25而不是50
<div class="row">
<div class="col-6">
<div class="field">
<%= f.label :first_name %><br />
<%= f.text_field :first_name, maxlength: 50, size: 25, autofocus: true, autocomplete: "First Name", class: "form-control" %>
</div>
</div>
<div class="col-6">
<div class="field">
<%= f.label :last_name %><br />
<%= f.text_field :last_name, maxlength: 50, size: 25, autocomplete: "Last Name", class: "form-control" %>
</div>
</div>
</div>
<br>