I've got a simple react table that is currently displayed in the following format:
[1][2][3][4]
[1][2][3][4]
[1][2][3][4]
[1][2][3][4]
But I want to add a media query for it to transform in to the following format when in a mobile view:
[1]
[2]
[3]
[4]
[1]
[2]
[3]
[4]
[1]
[2]
[3]
[4]
[1]
[2]
[3]
[4]
Problem is I just can't get it to work. I search and search and found the only possible solution was to add a set of order CSS values to each table cell e.g.:
<td className="cell-one"> One </td>
.cell-one {
order: 1;
}
But that still didn't work. The logic is there, I can half way see it but I just can't get it right. Any insight into how to achieve this would be very appreciated!
<table className="table-container">
<tbody>
<tr className="row">
<th className="header-row">First Name</th>
<th className="header-row">Surname</th>
<th className="header-row">Age</th>
<th className="header-row">Town</th>
</tr>
<tr className="row">
<td className="table-content">James</td>
<td className="table-content">Stout</td>
<td className="table-content">35</td>
<td className="table-content">Camden</td>
</tr>
<tr className="row">
<td className="table-content">Karen</td>
<td className="table-content">Smith</td>
<td className="table-content">40</td>
<td className="table-content">Stevenage</td>
</tr>
</tbody>
</table>