<link href='https://fonts.googleapis.com/css?family=Comfortaa:400,700' rel='stylesheet' type='text/css'>
<h1>Table Style</h1>
  <h2>Css + js</h2>

<section>
<table class="js-target">
  <thead>
    <tr>
      <th>Big heading1</th>
      <th>Big heading2</th>
      <th>Big heading3</th>
      <th>Big heading4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Content1</td>
      <td>Content2</td>
      <td>Content3</td>
      <td>Content4</td>
    </tr>
    <tr>
      <td>Content5</td>
      <td>Content6</td>
      <td>Content7</td>
      <td>Content8</td>
    </tr>
   </tbody>
</table>
<h3>↓</h3>
<div class="sp">
  <table class="js-target">
  <thead>
    <tr>
      <th>Big heading1</th>
      <th>Big heading2</th>
      <th>Big heading3</th>
      <th>Big heading4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Content1</td>
      <td>Content2</td>
      <td>Content3</td>
      <td>Content4</td>
    </tr>
    <tr>
      <td>Content5</td>
      <td>Content6</td>
      <td>Content7</td>
      <td>Content8</td>
    </tr>
   </tbody>
</table>
</div>
</section>
body{
  font-family: 'Comfortaa', cursive;
}

h1 {
  text-align: center;
  letter-spacing: 2px;
  font-weight: 300;
  font-size:40px;
  margin-top: 80px;
}

h2{
  text-align:center;
  font-size:25px;
  font-weight: 100;
  margin-top: 20px;
}

h3{
  text-align:center;
  margin: 30px 0px;
  font-size: 30px;
}

section{
  width: 500px;
  margin:50px auto;
  p{
    font-size:20px;
    font-weight: bold;
    margin-bottom: 15px;
  }
}

table{
  width:100%;
  margin: auto;
  tr{
    width: 100%;
  }
  th,td{
    box-sizing:border-box;
    padding: 15px;
  }
  thead{
    th{
      background: #000;
      color: #fff;
      text-align: left;
    }
  }

  tbody{
    text-align: left;
    th{
      background: #eee;
    }
  }
}

.table{
  width: 100%;
  display:table;
  .row{
    display:table;
    width: 100%;
  }
  .column{
    box-sizing:border-box;
    padding: 15px;
    width: 25%;
    text-align: left;
    display:table-cell;
  }
  .table-head{
    display:table;
    text-align: left;
    width: 100%;
    .column{
      background: #000;
      color: #fff;
      text-align: left;
      display:table-cell;
    }
  }
  tbody{
    display:table;
    width: 100%;
    .column{
      color: #000;
    }
  }
}

@media only screen and (max-width:420px){
  body{
    width: 100%;
  }
  section{
    box-sizing:border-box;
    width: 100%;
    padding: 0px 20px;
  }
  table{
    border-bottom:1px solid #ccc;
    tr{
      display: block;
      width: 100%;
    }
    tbody{
    display: block;
    width: 100%;
    overflow: hidden;
      th{
        list-style:none;
      }
      td{
        margin-left: 0px;
        border:1px solid #ccc;
        border-bottom: none;
      }
      th,td{
        width: 100%;
        display: block;
      }
    }
  }
  .table-head{
    display: none !important;
  }
  .row{
    margin-bottom: 30px;
    border-bottom: 1px solid #ccc;
  }
  .table{
    .column{
      width: 100%;
      display: block;
      border:1px solid #ccc;
      border-bottom: none;
      position:relative;
    }
  }
  tbody{
    position:relative;
    .column{
      &:before{
        content: attr(data-label);
        display: block;
        margin-bottom: 10px;
        font-weight: bold;
        color: #000;
        font-size:18px;
      }
    }
  }
}

.sp{
  width: 420px;
  margin: auto;
    .table-head{
    display: none !important;
  }
  .table {
    .column{
      display: block;
      width: 100%;
      border: 1px solid #ccc;
      border-bottom: none;
      position: relative;
    }
  }
  .row{
    border-bottom: 1px solid #ccc;
    margin-bottom:30px;
  }
  tbody{
    .column{
      &:before{
        content: attr(data-label);
        display: block;
        margin-bottom:10px;
        font-weight:bold;
        color:#000;
        font-size:18px;
      }
    }
  }
}
View Compiled
let $target = $('.js-target');

$target.each(function(){
  
  let i = '',
      $target_thead_col = $(this).find('thead th').length;

  for ( i=0; i<= $target_thead_col; i++){

    let $target_col_label =  $(this).find('tr th:nth-child('+ i +')').text();

    $(this).find('tr td:nth-child('+ i +')').replaceWith(function(){
        return $('<div class="column" data-label="'+ $target_col_label +'">').append($(this).contents());
        });
  }

  $(this).find('td').replaceWith(function(){
       return $('<div class="column">').append($(this).contents());
     });

  $(this).find('th').replaceWith(function(){
       return $('<div class="column">').append($(this).contents());
     });

  $(this).find('tr').replaceWith(function(){
       return $('<div class="row">').append($(this).contents());
     });

  $(this).find('thead').replaceWith(function(){
       return $('<div class="table-head">').append($(this).contents());
     });

  $(this).replaceWith(function(){
       return $('<div class="table">').append($(this).contents());
     });
});
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js