<div class="container">
  <h1 class="page-header mt-5 mb-5 mb-sm-0">Responsive table</h1>
  <p class="d-none d-sm-block mb-5">Please minimize your page until this post disappears</p>
  
  <div class="responsive-table">
    <table class="table table-bordered">
      <thead>
        <tr>
          <th>label1</th>
          <th>label2</th>
          <th>label3</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td data-label="label1">value1</td>
          <td data-label="label2">value2</td>
          <td data-label="label3">value3</td>
        </tr>
        <tr>
          <td data-label="label1">value1</td>
          <td data-label="label2">value2</td>
          <td data-label="label3">value3</td>
        </tr>
        <tr>
          <td data-label="label1">value1</td>
          <td data-label="label2">value2</td>
          <td data-label="label3">value3</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>  
.responsive-table {
  width: 100%;
  overflow-x: auto;
  table {
    border: 0;
    background-color: transparent !important;
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .responsive-table {
    table {
      thead {
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
      }
      tbody {
        tr {
          display: block;
          margin-bottom: 0.625em;
          td {
            display: block;
            text-align: right !important;
            height: auto;
            padding: 6px 5px;

            &:before {
              content: attr(data-label);
              float: left;
              font-weight: bold;
            }
          }
        }
      }
    }
  }
}
View Compiled

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css

External JavaScript

This Pen doesn't use any external JavaScript resources.