Html 如何使“接受条款”复选框内联的简单表单
:boolean,:label=>false,:boolean\u style=>:inline%> 接受真%> 而且是真的%> 结果是这样的Html 如何使“接受条款”复选框内联的简单表单,html,css,ruby-on-rails,twitter-bootstrap,simple-form,Html,Css,Ruby On Rails,Twitter Bootstrap,Simple Form,:boolean,:label=>false,:boolean\u style=>:inline%> 接受真%> 而且是真的%> 结果是这样的 将他们排在同一行的最佳方式是什么 确保复选框和文本足够小,可以放在容器内的一行中,然后设置display:inline或浮动:左侧尝试使用wrapper\u html如下: <p><%= f.input :terms, :as => :boolean, :label => false, :boolean_style =&
将他们排在同一行的最佳方式是什么 确保复选框和文本足够小,可以放在容器内的一行中,然后设置
display:inline代码>或<代码>浮动:左侧代码>尝试使用wrapper\u html
如下:
<p><%= f.input :terms, :as => :boolean, :label => false, :boolean_style => :inline %>
Accept <%= link_to "Terms of use", terms_path,:remote => true %>
and <%=link_to "privacy Policy", privacy_path, :remote => true%></p>
:布尔值,
:label=>false,
:boolean_style=>:内联,
:wrapper_html=>{:style=>'display:inline'}
%>
接受真%>
而且是真的%>
这里有一个相当简单的方法:
<p>
<%= f.input :terms,
:as => :boolean,
:label => false,
:boolean_style => :inline,
:wrapper_html => { :style => 'display: inline' }
%>
Accept <%= link_to "Terms of use", terms_path,:remote => true %>
and <%=link_to "privacy Policy", privacy_path, :remote => true%>
</p>
接受真%>
而且是真的%>
:boolean,:label=>content\u for(:链接)%>
display:inline不起作用,float left也起作用,但它看起来很奇怪,因为我的表单是居中的。块的内容使用得很好:)嘿,
的content\u有一个很好的技巧。非常有用。这仅在我将:label更改为:inline_label时适用
<%= content_for(:the_links) do %>
Accept <%= link_to "Terms of use", terms_path,:remote => true %>
and <%=link_to "privacy Policy", privacy_path, :remote => true%>
<% end %>
<%= simple_form_for @user do |f| %>
<%= f.input :email %>
<%= f.input :password %>
<%= f.input :terms, :as => :boolean, :label => content_for(:the_links)%>
<% end%>