Bootstrap 3 table - table-responsive not working

后端 未结 10 1119
攒了一身酷
攒了一身酷 2020-12-30 00:30

I\'m using bootstrap 3 for a website project. I\'m trying to create a page with a responsive table, so that I\'d have the scrollbar when the table is too big. I made a test

相关标签:
10条回答
  • 2020-12-30 01:29

    You're code is fine. I just set up a fiddle here.

    Works there!

    I literally copied and pasted your code. Are you sure your links to Bootstrap's Javascript file and CSS file are working?

    <div class="row">
     <h4>Nuværende kurser</h4>
      <div class="col-12 col-sm-12 col-lg-12">
       <div class="table-responsive">
        <table class="table">
         <thead>
          <tr>
            <th>#</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>1</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
          </tr>
          <tr>
            <td>2</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
          </tr>
          <tr>
            <td>3</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
          </tr>
        </tbody>
      </table>
      </div>
      </div><!-- end col-12 -->
      </div><!-- end row -->
    
    0 讨论(0)
  • 2020-12-30 01:30

    Try this
    remove <div class="table-responsive">...</div>
    and move class table-responsive in
    <div class="col-12 col-sm-12 col-lg-12">

    example

    <div class="col-12 col-sm-12 col-lg-12 table-responsive">

    this 100% work but if dont work move class table-responsive to Earlier Div layer, In this case,
    <div class="col-12 col-sm-12 col-lg-12">
    must be removed.

    0 讨论(0)
  • 2020-12-30 01:30

    In my code, I did add a CSS class:

    .modal-body{
      max-width:95vw;
    }
    

    The layout did work for sm

    0 讨论(0)
  • 2020-12-30 01:33

    For me it was the 'min-width' value in body element breaking the responsiveness of this class.

    0 讨论(0)
提交回复
热议问题