2017-07-27 107 views
0

引導倒塌調整表格

<div class="row"> 
 
     <div class="col-md-8"> 
 
      <h3 data-toggle="collapse" data-target="#collapseList" aria-expanded="false" aria-controls="collapseList"> 1 Lecturer List</h3> 
 
      <table class="table table-bordered collapse" id="collapseList"> 
 
      <thead> 
 
       <tr> 
 
        <th>List Id</th> 
 
        <th>List Name</th> 
 
        <th>Total Subscribers</th> 
 
        <th>Action</th> 
 
        <th>Problems</th> 
 
       </tr> 
 
      </thead> 
 
      <tr> 
 
       <td>a</td> 
 
       <td>abcdefg</td> 
 
       <td>a</td> 
 
       <td>Synchronize</td> 
 
       <td>NOK</td> 
 
      </tr> 
 
      </table> 
 
     </div> 
 
    </div>

這是我當我點擊標題標籤,它1此時出現第二種:

enter image description here

並經過1秒,這是我有什麼:

enter image description here

爲什麼我的表格在摺疊後調整大小?有沒有辦法調整表格的大小?

UPDATE:

這裏有一個的jsfiddle,你可以試試,看看自己,有一個問題https://jsfiddle.net/0zw5a845/

+0

你有任何崩潰的JS代碼? – Badiparmagi

+0

不,我沒有在這個頁面上的JavaScript – Didi

+0

請給我們提供一個MVCE的例子,但我的猜測是,你的潛水是由於你有一個col-md-8而不是col-md-12的事實。 –

回答

1

將下面的CSS行添加到主樣式表。這基本上覆蓋了引導樣式表的.collapse.in選擇器。

.collapse.in {display:table} 

Updated JSFiddle

+0

謝謝老兄!我仍然不明白爲什麼它有這種行爲... – Didi

+1

瀏覽器使用'display:table'屬性自然地呈現'

'元素,但是由於您明確將表設置爲塊級元素,所以'cell-padding','cell-spacing'和整體規則指示了表應該被渲染是固有的改變。 – MPaul

+0

非常感謝你的解釋:) – Didi

0

可能由於您的div有一類col-md-8的事實。

如果您想要一個跨越整個頁面寬度的表格,請將該類別更改爲col-md-12

+0

這是什麼,我起初,但同樣的問題,除了在倒塌過程中動畫的第二個表更大 – Didi