bootstrap将搜索表单放到右边

时间:2016-03-09 14:22:04

标签: html css ruby-on-rails ruby twitter-bootstrap

我通过bootstrap创建一个搜索表单,它在左边,但我想把表单放到右边。如何制作?

enter image description here

代码:

end

1 个答案:

答案 0 :(得分:4)

使用class="pull-right"类,如:

<div class="pull-right">
 <%= form_tag search_path, method: :get, class: "form-inline col-sm-4" do %>
  <div class="form-group">
   <%= text_field_tag :search, params[:search], class: "form-control", placeholder: "Search for..."%>
  </div>
  <div class="form-group">
  <%= submit_tag "Search", class: "btn btn-primary" %>
  </div>
 <% end %>
</div>