2016-11-09 87 views
0

我有一個表填充數據庫中的數據。雖然我一直在使用引導程序,但我一直在減小瀏覽器的寬度,從一點開始,表格就會出現在容器外面。我如何使這種響應?以下是附加的圖片bootstrap表沒有響應

<table class="table table-responsive table-bordered"> 


      <tr> 
       <th>Spare Id</th> 
       <th>Part Number</th> 
       <th>Quantity</th> 
       <th>Price</th> 
       <th>Warranty</th> 
       {{--<th>Description</th>--}} 
       <th>Spare Image</th> 

       <th> 


        <input type="text" class="form-control" id="search" placeholder="Search Spare"> 
       </th> 


      </tr> 
      <tbody id="tableModel"> 
      <?php 
      foreach($spares as $spare){ 

      ?> 
      <tr> 
       <td ><?php echo $spare->id;?></td> 
       <td ><?php echo $spare->partNumber;?></td> 
       <td ><?php echo $spare->quantity;?></td> 
       <td ><?php echo 'Rs.'. $spare->price;?></td> 
       <td ><?php echo $spare->warranty;?></td> 


       <td><?php echo '<img class="img-responsive" src="data:image/jpeg;base64,'.base64_encode($spare->image).'"/>';?></td> 
       <td> 

        <a class=" btn btn-success btn-sm" data-toggle="modal" data-target="#modalEdit" onclick="EditBrand('<?php echo $brand->brandName;?>','<?php echo $brand->id;?>')" >Edit </a> 

        <a onclick="DeleteBrand(<?php echo $brand->id;?>)" style="" class=" btn btn-danger btn-sm" >Delete </a> 

       </td> 

      </tr> 

      <?php }?> 
      </tbody> 


     </table> 

This is when the normal width

When i kept on decreasing the size

+2

圖片很不錯,但我們需要查看您的代碼。請參閱[mcve] – j08691

+0

您的表格可能有固定的寬度或最小的寬度 – Jon

+0

不,沒有稱爲最小寬度的樣式 – hEShaN

回答

3

如果使用引導程序。用table-responsive類包裝div

<div class="table-responsive"> 
    <table class="table"> 
     ... 
    </table> 
</div> 

這應該工作,如果啓動正確集成。請顯示你的代碼。更多的人會幫助你。

+0

我已經完成了它。 – hEShaN

+0

不錯。我的回答將解決你的問題。請注意我的答案中的div元素! – Nope

+0

謝謝你的隊友! – hEShaN