我有一个简单的反应表,目前以以下格式显示:
[1][2][3][4]
[1][2][3][4]
[1][2][3][4]
[1][2][3][4]
但是我想添加一个媒体查询,以便在移动视图中转换为以下格式:
[1]
[2]
[3]
[4]
[1]
[2]
[3]
[4]
[1]
[2]
[3]
[4]
[1]
[2]
[3]
[4]
问题是我无法让它工作。我搜索和搜索,发现唯一可能的解决方案是向每个表格单元格添加一组顺序 CSS 值,例如:
<td className="cell-one"> One </td>
.cell-one {
order: 1;
}
但这仍然没有奏效。逻辑就在那里,我可以看到一半,但我就是无法正确理解。任何有关如何实现这一目标的见解将不胜感激!
<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>