I have a html table:
<table>
<tr> <td>data...</td> <td>data...</td> <td>data...</td> </tr>
</table>
This shows as:
-------------------------
|data...|data...|data...|
-------------------------
which is fine on large screens, but what i want is to break the columns into multiple rows as needed if the screen is small.
So when needed the table would show as:
----------
|data....|
|--------|
|data....|
|--------|
|data....|
----------
Is there a way to do this with something like css?
You can change to display: table-row
with media queries Fiddle
@media(max-width: 480px) {
td {
display: table-row;
}
}
<table>
<tr> <td>data...</td> <td>data...</td> <td>data...</td> </tr>
</table>
You can use display:block as for break the column
@media(max-width: 480px) {
td {
display:block;
}
}
<table>
<tr> <td>data...</td> <td>data...</td> <td>data...</td> </tr>
</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