Boostrap + Rails表格行中的按钮组下的空白区域

时间:2016-01-24 23:22:13

标签: css ruby-on-rails twitter-bootstrap-3

我的某个表格单元格中的按钮组出现问题。 它看起来像我在下面的图像:

enter image description here

查看文件:

= render 'layouts/navbar'
= render 'layouts/sidebar'

div class = 'container-fluid'
  div class =  'col-sm-2'
  div class =  'col-sm-10'
    h1 Listing Copies
    table class = 'table table-hover'
      thead
        tr
          th Title
          th Author
          th Photo
          th Options

      tbody
        - @copies.each do |copy|
          tr class = 'warning'
            td = copy.book.title
            td = copy.book.author
            td = image_tag( copy.photo, class: 'preview')
            td class = 'btn-group'
              - if copy.returned?
                = link_to 'Rent', new_history_path(copy_id: copy.id), class: 'btn btn-primary'
              - else
                = link_to 'Rent', new_history_path(copy_id: copy.id), disabled: true, class: 'btn btn-danger'
              = link_to 'Show', copy, class: 'btn btn-default'
              = link_to 'Edit', edit_copy_path(copy), class: 'btn btn-default'
              = link_to 'Destroy', copy, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-default'
    = link_to 'New Copy', new_copy_path, class: 'btn btn-default'

还有一些css:

.btn-group {
  display: flex;
}

任何建议都会对我有所帮助。感谢。

1 个答案:

答案 0 :(得分:0)

好的,我解决了这个问题 - 我不应该做td class = 'btn-group'。而不是:

td
  div class = 'btn-group'