2016-11-09 95 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