我是初学者。 我想把两个按钮放在一行。
如何将按钮正确放在桌子的一条线上?
两个按钮:
<%= button_to "empty Cart", @cart, method: :delete %>
<%= submit_tag "Delete item" %>
我的观点 &lt;%= form_tag destroy_multiple_carts_path,方法:: delete do%&gt;
<table class="table">
<tbody>
<tr>
<td class = "checkbox_size_sm"><input type="checkbox"></td>
<td class = "image">ITEM</td>
<td class = "title"> </td>
<td>PRICE</td>
</tr>
<% @cart.line_items.order(created_at: :desc).each do |item| %>
<tr>
<td><%= check_box_tag "item_ids[]", item.id %></td>
<td class = "image"><%= image_tag item.product.item, size: "100" %>
</td>
<td class = "title" id = "td_align_middle">
<%= item.product.title %><br>
<%= item.product.brand %>
</td>
<td id = "td_align_middle"><%= item.product.price %></td>
</tr>
<% end %>
</tbody>
<tfoot>
<tr>
<td colspan = "4" class="total_price" >
Total Price <strong> <%= @cart.cart_total_price %> </strong>
</td>
</tr>
<tr>
<td colspan ="4" class="al-r">
<%= button_to "empty Cart", @cart, method: :delete %> <%= submit_tag "Delete item" %>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
帮帮我......
答案 0 :(得分:0)
将这些按钮包装在div中,将div设置为向左浮动并溢出隐藏
使用class divname在div中添加软管两个按钮,并在css文件中添加以下样式
div.divname button { float:left; margin-right:10px; }