css - rails css 如何将两个按钮排成一行

标签 css ruby-on-rails

我是 Rails 初学者。 我想制作两个排成一行的按钮。

如何将按钮正确地放在表格的一行上?

两个按钮:

<%= button_to "empty Cart", @cart, method: :delete %>
 <%= submit_tag "Delete item" %>        

我的观点 <%= form_tag destroy_multiple_carts_path,方法::delete do %>

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

帮帮我..

最佳答案

将这些按钮包裹在一个 div 中,将 div 设置为向左浮动并 overflow hidden 在带有 divname 类的 div 中添加软管两个按钮,并在 css 文件中添加以下样式 div.divname button { float:left;右边距:10px; }

关于css - rails css 如何将两个按钮排成一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29317894/

相关文章:

html - 表格中的字体在移动浏览器上呈现不一致

php - 上传网站后从右到左的问题

ruby-on-rails - 通过下拉菜单缩小连接表中的元素。 ( rails 4)

javascript - jQuery 未检测到点击链接

mysql - MySQL 和 Rails 中的外键建议

ruby-on-rails - rails 实现删除的属性

html - Bootstrap 4 输入显示 'invalid-feedback' 时出现跳转问题

css - 当模态在 React 中可见时平滑过渡

html - css overflow-x 隐藏在诺基亚设备中不起作用

ruby-on-rails - eager_load=true 有什么影响?