当我在轨道中隐藏按钮时,其他按钮移动到那个地方我想将按钮放在一条平行线上,如果那些按钮不可见,那么其他按钮的位置应该是清晰的....我的代码如下:
<div class=" list_el">
<span class="pull-right" style="text-align:right">
<%if accountant?%>
<%= link_to_if(!crm_donation["received"], "Approved", crm_donations_path(:id => crm_donation["id"]), :class => "label label-success") if !crm_donation["received"]%>
<%end%>
<%= link_to "rollback", edit_crm_donation_rollback_path(crm_donation["id"]), :class => 'label label-info' if supervisor? && crm_donation["rollback_id"].blank?%>
<%= link_to "delete", crm_donation_path(crm_donation["id"]), :class => 'label label-important1', method: :delete, data: { confirm: 'Are you sure?' } if accountant? && !crm_donation["received"]%>
<%= link_to "details", crm_donation_path(crm_donation["id"]), :class => 'label label-success' %>
<%if !accountant?%>
<%= link_to "pdf", "/letter/#{crm_donation["id"]}.pdf", :class => "label label-info1", :target=>"_blank"%>
<%if crm_donation["email_sent"]%>
<%=link_to_if(crm_donation["received"], "email", donation_email_sent_path(crm_donation["email_sent"]), :class=>"label label-emails") { label_tag( "email" , "email",:class => "label") }%>
<%else%>
<%if !crm_donation["rollback_id"]%>
<%=link_to_if(crm_donation["received"], "email", new_donation_email_sent_path(:donation_id => crm_donation["id"]), :class=>"label label-emailf") { label_tag( "email" , "email",:class => "label") } %>
<%end%>
<%end%>
<%end%>
</span>
</div>
按钮位置是这样的:
details | pdf
rollback | details | pdf | email
我希望这样做:
details | pdf
rollback | details | pdf | email
答案 0 :(得分:0)
首先删除内联样式并将所有样式放在资产管道中。为每个按钮创建div,然后使用css定位来正确对齐它们。如果你隐藏了一些按钮并且它正在改变按钮的对齐方式(正如你在问题中提到的那样),那么使用visibility:hidden而不是display:none。当您执行可见性时:隐藏到特定元素,该元素仍然存在,但它是隐藏的