2016-03-09 57 views
1

我通過bootstrap製作搜索表單,它位於左側,但我希望將表單設置爲正確。如何做到這一點?bootstrap將搜索表單右移

enter image description here

代碼:

<%= 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 %> 
+3

使用類'拉right' –

回答

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> 
+0

它的工作!謝謝! – pangpang

+0

如果答案對您有用,請接受它。這樣你可以幫助那些幫助你的人,@pangpang。 –