Why use flexbox to simulate a table?
It can reverse the
<table>
without JavaScript. This is quite usable under some particular scenarios.Alternative method
Another method to reverse table rows doesn’t need flexbox — rotate
<tbody>
and<tr>
180 degree:
1
2
3
4
5 table.reverse {
tbody, tbody > tr {
transform: rotate(180deg);
}
}
This works under latest Chrome/Firefox for macOS/Linux pretty well. However, this will rediculously corrupt the rendering of Electron. (tested under Electron v1.7.8 for Windows). I don’t know why.
I use the terms of HTML’s native table, so it’s more comprehensible for experienced HTML developer.
HTML
1 | .flex-table |
CSS
1 | .flex-table { |