My goal is to create a responsive table with 4 columns when the window size is larger than 600px, and switch to 2 columns for mobile view. I am using bootstrap framework to achieve this. Below is the structure of the table that I want to display:
-----------------------------
| th1 | th2 | th3 | th4 |
-----------------------------
| val1 | val2 | val3 | val4 |
-----------------------------
| th5 | th6 | th7 | th8 |
-----------------------------
| val5 | val6 | val7 | val8 |
In mobile view, I would like it to look like this:
--------------
| th1 | val1 |
---------------
| th2 | val2 |
--------------
| th3 | val3 |
--------------
| th4 | val4 |
--------------
| th5 | val5 |
--------------
| th6 | val6 |
--------------
| th7 | val7 |
--------------
| th8 | val8 |
Currently, I have the following code snippet for the table:
<table class="table table-bordered table-striped">
<tbody class="center">
<tr>
<th>th1</th>
<th>th2</th>
<th>th3</th>
<th>th4</th>
</tr>
<tr>
<td>val1</td>
<td>val2</td>
<td>val3</td>
<td>val4</td>
</tr>
<tr>
<th>th5</th>
<th>th6</th>
<th>th7</th>
<th>th8</th>
</tr>
<tr>
<td>val5</td>
<td>val6</td>
<td>val7</td>
<td>val8</td>
</tr>
</tbody>
</table>