2011-12-28 87 views
0

這裏是在我看來,相關代碼:如何將我的鏈接到我的右邊提交按鈕

<%= form_for CustomerEmail.new, :html => {:class => "js-ajax-submit js-customer-email-form invisible", :rel => {:reload => true}.to_json} do |c| -%> 
    <%= c.label :email, 'Email' %> 
    <%= c.text_field :email %> 
    <%= c.submit "Submit", :class => "small-button" %> 
    <a href="#" class='js-close-popup'>Cancel</a> 
<% end -%> 

目前的「取消」鏈接被放置在文本框的右側標有「電子郵件」。我需要將它移到提交按鈕的右側。

我試過所有我知道的html標籤:div,span,td,tr,li。這些都不是我需要的地方。 我也嘗試了一些CSS:style='float: right; padding-top: 5px; padding-right: 20px; padding-bottom: 5px'

沒有運氣....

+0

你不會碰巧有'文本align'屬性設置爲'right'您的包含元素,你會? – Aaron 2011-12-28 16:41:23

+1

默認情況下,取消鏈接應顯示在提交按鈕的右側。您必須在導致此問題的混合中使用其他一些CSS。這可能是由於一些浮動規則。 – jessegavin 2011-12-28 16:41:45

+3

您需要將所有相關的CSS與您的代碼一起包含在內,否則我們將不得不猜測問題可能出在哪裏,而且這並不好玩。 – jessegavin 2011-12-28 16:42:56

回答

0
<%= form_for CustomerEmail.new, :html => {:class => "js-ajax-submit js-customer-email-form invisible", :rel => {:reload => true}.to_json} do |c| -%> 
    <%= c.label :email, 'Email' %> 
    <%= c.text_field :email %> 

    <div style="float: right"> 
    <%= c.submit "Submit", :class => "small-button", :style => "float: left;" %> 
    <div style="display: block; float: left; padding: 5px 0px 5px 20px;"> 
     <a href="#" class='js-close-popup'>Cancel</a> 
    </div> 
    </div> 
<% end -%>