提问人:James 提问时间:12/27/2022 更新时间:12/27/2022 访问量:68
Bootstrap Rails 以内联方式而不是上面字段形成标签
Bootstrap Rails Form Label Inline Instead of Above Field
问:
我有以下表单,将这个 gem 用于 Rails Bootstrap 表单: https://github.com/bootstrap-ruby/bootstrap_form
我的表单代码如下所示:
<%= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<div class="field ">
<%= f.email_field :email, label_class: "text-light lead"%>
</div>
<div class="field">
<%= f.password_field :password, autocomplete: "new-password", help: 'A good password should be at least six characters long', label_class: "text-light lead" %>
</div>
<div class="field">
<%= f.password_field :password_confirmation, autocomplete: "new-password", label_class: "text-light lead" %>
</div>
<div class="actions">
<%= f.submit "Sign up" %>
</div>
<% end %>
我希望我的电子邮件标签与表单字段内联,而不是在表单字段上方。下面是上面代码的窗体外观的图像:
我怎样才能做到这一点? 谢谢!
答:
0赞
Beartech
12/27/2022
#1
您是否阅读了bootstrap_form的文档?每:https://github.com/bootstrap-ruby/bootstrap_form#horizontal-forms
<%= bootstrap_form_for(resource, as: resource_name, layout: :horizontal, label_col: "col-sm-2", control_col: "col-sm-10", url: registration_path(resource_name)) do |f| %>
...
下一个:引导程序中的图像网格作为按钮
评论