Ruby on rails Rails 4表单引导修复程序?
我用的是宝石。我的html输出中有两个标签,输入字段的宽度达到了100%。我怎么修理它? 这是我的Desive new.html.erb:Ruby on rails Rails 4表单引导修复程序?,ruby-on-rails,twitter-bootstrap,devise,Ruby On Rails,Twitter Bootstrap,Devise,我用的是宝石。我的html输出中有两个标签,输入字段的宽度达到了100%。我怎么修理它? 这是我的Desive new.html.erb: <h2>Sign up</h2> <%= bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> <%= devise_error_messages!
<h2>Sign up</h2>
<%= bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.submit "Sign up" %></div>
<% end %>
<%= render "devise/shared/links" %>
注册
资源名称:url=>注册路径(资源名称))do | f |%>
正确%>
这是我的html输出:
电子邮件
电子邮件
密码
密码
密码确认
密码确认
您将获得重复的字段,因为电子邮件字段
、密码字段
等。助手已经为您在其中添加了标签。所以你真的需要这个:
<%= f.email_field :email, :autofocus => true %>
<%= f.password_field :password %>
etc...
true%>
等
您的字段是100%宽度,因为这是Bootstrap3的默认值。具体而言,请参见,其中说明:
All textual <input>, <textarea>, and <select> elements with
.form-control are set to width: 100%; by default.
所有文本和元素
.窗体控件设置为宽度:100%;默认情况下。
All textual <input>, <textarea>, and <select> elements with
.form-control are set to width: 100%; by default.