Bootstrap grids and responsive table

I am using bootstrap grid and responsive table.  I need to show four tables in a row. So my code looks like this..

<div class="row">
      <div class="col-sm-3">

        
      <div class="responsive-table">
        <table class="table table--bordered table--nostripes table--wrap table--compressed table--nowrap--col--1">

          <thead>
          <tr>
            <th colspan="2" class="text-center">How Bad</th>
          </tr>
          </thead>

          <tbody>
          <tr>
            <td style="border:none">Priority:</td>
            <td style="border:none">NA</td>
          </tr>
          <tr>
            <td style="border: none">DE-priority:</td>
            <td style="border: none">3</td>
          </tr>
          <tr>
            <td style="border: none">BadCodeFlag:</td>
            <td style="border: none">N</td>
          </tr>
          <tr>
            <td style="border: none">Regression:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Is-customer-visible:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Not-customer-visible-reason:</td>
            <td style="border: none">Defect ignored - The IGNORE/PREFCS flags are in the RNE-More Info:<a
              href="http://swtg.cisco.com/display/BST/When+a+Bug+is+Not+Visible+to+Customers">Visibility Conditions </a>
            </td>
          </tr>
          </tbody>

        </table>
      </div>




      </div>
      <div class="col-sm-3">
       
      <div class="responsive-table">
        <table class="table table--bordered table--nostripes table--wrap table--compressed table--nowrap--col--1">

          <thead>
          <tr>
            <th colspan="2" class="text-center">How Bad</th>
          </tr>
          </thead>

          <tbody>
          <tr>
            <td style="border:none">Priority:</td>
            <td style="border:none">NA</td>
          </tr>
          <tr>
            <td style="border: none">DE-priority:</td>
            <td style="border: none">3</td>
          </tr>
          <tr>
            <td style="border: none">BadCodeFlag:</td>
            <td style="border: none">N</td>
          </tr>
          <tr>
            <td style="border: none">Regression:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Is-customer-visible:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Not-customer-visible-reason:</td>
            <td style="border: none">Defect ignored - The IGNORE/PREFCS flags are in the RNE-More Info:<a
              href="http://www.hotmail.com/chain/chain/chain/chain">Visibility Conditions </a>
            </td>
          </tr>
          </tbody>

        </table>
      </div>



      </div>
      <div class="col-sm-3">
 
      <div class="responsive-table">
        <table class="table table--bordered table--nostripes table--wrap table--compressed table--nowrap--col--1">

          <thead>
          <tr>
            <th colspan="2" class="text-center">How Bad</th>
          </tr>
          </thead>

          <tbody>
          <tr>
            <td style="border:none">Priority:</td>
            <td style="border:none">NA</td>
          </tr>
          <tr>
            <td style="border: none">DE-priority:</td>
            <td style="border: none">3</td>
          </tr>
          <tr>
            <td style="border: none">BadCodeFlag:</td>
            <td style="border: none">N</td>
          </tr>
          <tr>
            <td style="border: none">Regression:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Is-customer-visible:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Not-customer-visible-reason:</td>
            <td style="border: none">Defect ignored - The IGNORE/PREFCS flags are in the RNE-More Info:<a
              href="http://www.hotmail.com/chain/chain/chain/chain">Visibility Conditions </a>
            </td>
          </tr>
          </tbody>

        </table>
      </div>



      </div>
      <div class="col-sm-3">
      
      <div class="responsive-table">
        <table class="table table--bordered table--nostripes table--wrap table--compressed table--nowrap--col--1">

          <thead>
          <tr>
            <th colspan="2" class="text-center">How Bad</th>
          </tr>
          </thead>

          <tbody>
          <tr>
            <td style="border:none">Priority:</td>
            <td style="border:none">NA</td>
          </tr>
          <tr>
            <td style="border: none">DE-priority:</td>
            <td style="border: none">3</td>
          </tr>
          <tr>
            <td style="border: none">BadCodeFlag:</td>
            <td style="border: none">N</td>
          </tr>
          <tr>
            <td style="border: none">Regression:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Is-customer-visible:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Not-customer-visible-reason:</td>
            <td style="border: none">Defect ignored - The IGNORE/PREFCS flags are in the RNE-More Info:<a
              href="http://www.hotmail.com/chain/chain/chain/chain">Visibility Conditions </a>
            </td>
          </tr>
          </tbody>

        </table>
      </div>



      </div>
    </div>

Open in new window


The problem: is in responsiveness... when I reduce the size of the browser, table shows horizontal scroll , instead of continuously wrapping and stacking tables by resizing them. I want it to be able to resize and position appropriately  as I expand or reduce my page size. How can I achieve this?
Dev MeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NerdsOfTechTechnology ScientistCommented:
First, bootstrap class .responsive-table reacts with a horizontal scroll at all breakpoints.

You'll want to use the lowest breakpoint in the class set: .table-responsive-sm

(note: at XS breakpoint, the horizontal scrolling will appear by default)

From that breakpoint and up, the table will behave normally and not scroll horizontally.

ref: https://getbootstrap.com/docs/4.0/content/tables/#always-responsive

<div class="row">
      <div class="col-sm-3">

        
      <div class="responsive-table-sm">
        <table class="table table--bordered table--nostripes table--wrap table--compressed table--nowrap--col--1">

          <thead>
          <tr>
            <th colspan="2" class="text-center">How Bad</th>
          </tr>
          </thead>

          <tbody>
          <tr>
            <td style="border:none">Priority:</td>
            <td style="border:none">NA</td>
          </tr>
          <tr>
            <td style="border: none">DE-priority:</td>
            <td style="border: none">3</td>
          </tr>
          <tr>
            <td style="border: none">BadCodeFlag:</td>
            <td style="border: none">N</td>
          </tr>
          <tr>
            <td style="border: none">Regression:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Is-customer-visible:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Not-customer-visible-reason:</td>
            <td style="border: none">Defect ignored - The IGNORE/PREFCS flags are in the RNE-More Info:<a
              href="http://swtg.cisco.com/display/BST/When+a+Bug+is+Not+Visible+to+Customers">Visibility Conditions </a>
            </td>
          </tr>
          </tbody>

        </table>
      </div>




      </div>
      <div class="col-sm-3">
       
      <div class="responsive-table-sm">
        <table class="table table--bordered table--nostripes table--wrap table--compressed table--nowrap--col--1">

          <thead>
          <tr>
            <th colspan="2" class="text-center">How Bad</th>
          </tr>
          </thead>

          <tbody>
          <tr>
            <td style="border:none">Priority:</td>
            <td style="border:none">NA</td>
          </tr>
          <tr>
            <td style="border: none">DE-priority:</td>
            <td style="border: none">3</td>
          </tr>
          <tr>
            <td style="border: none">BadCodeFlag:</td>
            <td style="border: none">N</td>
          </tr>
          <tr>
            <td style="border: none">Regression:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Is-customer-visible:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Not-customer-visible-reason:</td>
            <td style="border: none">Defect ignored - The IGNORE/PREFCS flags are in the RNE-More Info:<a
              href="http://swtg.cisco.com/display/BST/When+a+Bug+is+Not+Visible+to+Customers">Visibility Conditions </a>
            </td>
          </tr>
          </tbody>

        </table>
      </div>



      </div>
      <div class="col-sm-3">
 
      <div class="responsive-table-sm">
        <table class="table table--bordered table--nostripes table--wrap table--compressed table--nowrap--col--1">

          <thead>
          <tr>
            <th colspan="2" class="text-center">How Bad</th>
          </tr>
          </thead>

          <tbody>
          <tr>
            <td style="border:none">Priority:</td>
            <td style="border:none">NA</td>
          </tr>
          <tr>
            <td style="border: none">DE-priority:</td>
            <td style="border: none">3</td>
          </tr>
          <tr>
            <td style="border: none">BadCodeFlag:</td>
            <td style="border: none">N</td>
          </tr>
          <tr>
            <td style="border: none">Regression:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Is-customer-visible:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Not-customer-visible-reason:</td>
            <td style="border: none">Defect ignored - The IGNORE/PREFCS flags are in the RNE-More Info:<a
              href="http://swtg.cisco.com/display/BST/When+a+Bug+is+Not+Visible+to+Customers">Visibility Conditions </a>
            </td>
          </tr>
          </tbody>

        </table>
      </div>



      </div>
      <div class="col-sm-3">
      
      <div class="responsive-table-sm">
        <table class="table table--bordered table--nostripes table--wrap table--compressed table--nowrap--col--1">

          <thead>
          <tr>
            <th colspan="2" class="text-center">How Bad</th>
          </tr>
          </thead>

          <tbody>
          <tr>
            <td style="border:none">Priority:</td>
            <td style="border:none">NA</td>
          </tr>
          <tr>
            <td style="border: none">DE-priority:</td>
            <td style="border: none">3</td>
          </tr>
          <tr>
            <td style="border: none">BadCodeFlag:</td>
            <td style="border: none">N</td>
          </tr>
          <tr>
            <td style="border: none">Regression:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Is-customer-visible:</td>
            <td style="border: none">Y</td>
          </tr>
          <tr>
            <td style="border: none">Not-customer-visible-reason:</td>
            <td style="border: none">Defect ignored - The IGNORE/PREFCS flags are in the RNE-More Info:<a
              href="http://swtg.cisco.com/display/BST/When+a+Bug+is+Not+Visible+to+Customers">Visibility Conditions </a>
            </td>
          </tr>
          </tbody>

        </table>
      </div>



      </div>
    </div>

Open in new window

0
lenamtlCommented:
I work a lot with Bootstrap and for responsive table the best option to my opinion is to use Datatables with responsive
https://datatables.net/extensions/responsive/examples/initialisation/className.html

You can create your package using what you need
https://datatables.net/download/

Plus Datatables have plenty of useful feature (pages, export, resize ...) and it is very flexible.
1
Dev MeAuthor Commented:
I will try out both solution and update the post.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Dev MeAuthor Commented:
@NerdsOfTech

using .table-responsive-sm  indeed removes the horizontal scroll bar but at the expense of expanding or overlapping to adjacent column.
0
Dev MeAuthor Commented:
@lenamtl

Datatables don't scroll but reducing browser size does hide the column which is not ideal.
0
Dev MeAuthor Commented:
added all col-sm, col-xs, col-md and col-xl to all the column.
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.