I have a table with 3 row like below. How can I change the order of row by CSS? Example:
And I want it become:
<table class="details">
<tbody>
<tr class="name">
<td class="label"><label for="name">Fullname</label></td>
<td class="value name-wrapper">name</td>
</tr>
<tr class="Age">
<td class="label"><label for="age">Age</label></td>
<td class="value age-wrapper">26</td></tr>
<tr class="Country">
<td class="label"><label for="country">Country</label></td>
<td class="value country-wrapper">US</td></tr>
</tbody>
</table>
You can use flex-direction: column-reverse
on parent elements to reverse the order of their children. Use flex-direction: row-reverse
for rows.
tbody { display: flex; flex-direction: column-reverse; }
<table class="details">
<tbody>
<tr class="name">
<td class="label"><label for="name">Fullname</label></td>
<td class="value name-wrapper"></td>
</tr>
<tr class="Age">
<td class="label"><label for="age">Age</label></td>
<td class="value age-wrapper"></td>
</tr>
<tr class="Country">
<td class="label"><label for="country">Country</label></td>
<td class="value country-wrapper"></td>
</tr>
</tbody>
</table>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With